<?php
if ($this->ma == 2) {
    echo '<script language="javascript" type="text/javascript">alert("完成和取消的运单不能出现问题！");</script>';
} else if ($this->ma == 1) {
    echo '<script language="javascript" type="text/javascript">alert("问题运单标记成功！");location.href="/admini/managewaybill/billaccep/id/' . $this->billall->id . '?_rf=' . urlencode($this->referer) . '";</script>';
} else if ($this->ma == 3) {
    echo '<script language="javascript" type="text/javascript">alert("设置成功！");location.href="/admini/managewaybill/billaccep/id/' . $this->billall->id . '?_rf=' . urlencode($this->referer) . '";</script>';
} else if ($this->ma == 4) {
    echo '<script language="javascript" type="text/javascript">alert("请检查运单的前后台状态！");location.href="/admini/managewaybill/billaccep/id/' . $this->billall->id . '?_rf=' . urlencode($this->referer) . '";</script>';
} else if ($this->ma == 5) {
    echo '<script language="javascript" type="text/javascript">alert("留言内容不能为空！");location.href="/admini/managewaybill/billaccep/id/' . $this->billall->id . '?_rf=' . urlencode($this->referer) . '";</script>';
} else if ($this->ma == 6) {
    echo '<script language="javascript" type="text/javascript">alert("请先制作发票！");location.href="/admini/managewaybill/billaccep/id/' . $this->billall->id . '?_rf=' . urlencode($this->referer) . '";</script>';
}
$pd = true;
$premiumFee = $this->billall->getFeeByType(Application_Model_FeeType::RatePremiumFee);
?>
<div class="admin_nrtop">
    <div class="yundantopleft">
        <div class="yundancz">
            <div class="nui-toolbar-item">
                <div class="nui-btn ">
                    <a href="<?= $this->referer ?>" class="nui-btn-text"><span>&lt;&lt;</span>返回</a>
                </div>
            </div>                    
            <div class="nui-toolbar-item">
                <div class="nui-btn ">
                    <a href="javascript:void(0)" id='issue' class="nui-btn-text">问题包裹</a>
                </div>
                <div class="nui-btn ">
                    <a href="/admini/managewaybill/invoice/id/<?php echo $this->billall->id ?>" class="nui-btn-text">编辑发票</a>
                </div>
                <div class="nui-btn" id="editupdete">
                    <a href="javascript:void(0)" class="nui-btn-text rxl" id="editInterior">修改后台状态<i></i></a>
                    <div class="ztlist" style="display:none;">
                        <ul>
                            <?php foreach ($this->billall->EditInteriorAll as $key => $eccomp) { ?>
                                <li><a href="javascript:editInterior(<?php echo $key; ?>,'<?php echo $eccomp; ?>')"><?php echo $eccomp; ?></a></li>
                            <?php } ?>
                        </ul>
                    </div>
                </div>
                <div class="nui-btn " id="updeteedit">
                    <a href="javascript:void(0)" class="nui-btn-text rxl" id="editStatus">修改前台状态<i></i></a>
                    <div class="ztlist" style="display:none;">
                        <ul>
                            <?php foreach ($this->billall->EditStatusAll as $key => $eccomp) { ?>
                                <li><a href="javascript:editStatus(<?php echo $key; ?>,'<?php echo $eccomp; ?>')"><?php echo $eccomp; ?></a></li>
                            <?php } ?>
                        </ul>
                    </div>
                </div>
                <div class="nui-btn ">
                    <a href="javascript:void(0)" id='remarkUuch' class="nui-btn-text">内部备注</a>
                </div>
                <div class="nui-btn ">
                    <a href="javascript:void(0)" id='bagProperty' class="nui-btn-text">包裹属性</a>
                </div>
                <div class="nui-btn ">
                    <a href="javascript:void(0)" id="cancel" class="nui-btn-text">取消</a>
                </div>
            </div>     
            <div class="nui-toolbar-item">
                <div class="nui-btn ">
                <?php 
                if ($this->storedetail != '') {
                            $locationNos=array();
                            foreach ($this->storedetail as $storeItem) {
                                $Item = $storeItem->StoreIdByItem;
                                $locationNos=$Item->locationNo;
                                if(empty($locationNos)||$locationNos==NULL){
                    ?>
                        <script type="text/javascript">
                            $("#print-text").live("click", function() {
                                alert('物品没库位，请入库位后打单！');
                                return false;
                            });
                            $("#print-t").live("click", function() {
                                alert('物品没库位，请入库位后打单！');
                                return false;
                            });
                            $("#print-address").live("click", function() {
                                alert('物品没库位，请入库位后打单！');
                                return false;
                            });
                            $("#print-bill").live("click", function() {
                                alert('物品没库位，请入库位后打单！');
                                return false;
                            });
                            $("#print-list").live("click", function() {
                                alert('物品没库位，请入库位后打单！');
                                return false;
                            });
                        </script>

                               <?php } ?> 
                               <?php } ?>
                               <?php } ?>
                <a href="/admini/managewaybill/print/id/<?php echo $this->billall->id; ?>" class="nui-btn-text" id='print-text'>打印清单</a>
                </div>
                <div class="nui-btn ">
                    <a href="/admini/managewaybill/addform/id/<?php echo $this->billall->id; ?>" class="nui-btn-text">地址标签</a>
                </div>
                <?php if (in_array($this->billall->channer, array("37", "38", "52", "54", "82", "89", "90", "110", "120", "121", "125", "206", "211", "213", "216", "288", "289", "290", "291", "294", "295", "322", "323"))) { ?>
                    <div class="nui-btn ">
                        <a href="/admini/job/eubpdf?id=<?php echo $this->billall->id; ?>" target="_blank" class="nui-btn-text">下载PDF</a>
                    </div>
                <?php } ?>
                <div class="nui-btn ">
                    <a href="<?php echo $this->invoicedetail ? "/admini/managewaybill/invoice/ma/5/id/" . $this->billall->id : "/admini/managewaybill/invoice/id/" . $this->billall->id; ?>" class="nui-btn-text">打印发票</a>
                </div>
                <div class="nui-btn ">
                    <a href="/admini/managewaybill/addbill/id/<?php echo $this->billall->id; ?>" class="nui-btn-text">快递单</a>
                </div>
            </div>     
            <?php $editChannel = Application_Model_WayLog::getByWayIdInteriorType($this->billall->id, Application_Model_WayLog::Type_BillAffirmChannel); ?>
            <div class="nui-toolbar-item">
                <div class="nui-btn " id='print-t'>
                    <a href="http://localhost:5997/Print.ashx?type=1&wayId=<?php echo $this->billall->id; ?>&shipId=<?php echo $editChannel ? $editChannel->description : $this->billall->channer; ?>" target="_blank" class="nui-btn-text">打印清单-t</a>
                </div>
                <div class="nui-btn " id='print-address'>
                    <a href="http://localhost:5997/Print.ashx?type=2&wayId=<?php echo $this->billall->id; ?>&shipId=<?php echo $editChannel ? $editChannel->description : $this->billall->channer; ?>" class="nui-btn-text" target="_blank">地址标签-t</a>
                </div>
                <div class="nui-btn " id='print-bill'>
                    <a href="http://localhost:5997/Print.ashx?type=4&wayId=<?php echo $this->billall->id; ?>&shipId=<?php echo $editChannel ? $editChannel->description : $this->billall->channer; ?>" class="nui-btn-text" target="_blank">快递单-t</a>
                </div>
                <div class="nui-btn " id='print-list'>
                    <a href="http://localhost:5997/Print.ashx?type=0&wayId=<?php echo $this->billall->id; ?>&shipId=<?php echo $editChannel ? $editChannel->description : $this->billall->channer; ?>" class="nui-btn-text" target="_blank">一键打印全部</a>
                </div>
            </div>   
        </div>
        <div class="yundangrinfo">
            <p>悠奇运单编号：<?php echo $this->billall->billNo; ?><span>|</span>
                用户：<a href="/admini/manageuser/userdetail/id/<?php echo $this->billall->userId; ?>" target="_blank"><?php echo $this->billall->user->nikename; ?></a><span>|</span>
                仓库号：<a href="/admini/managestore/index/nostore/<?php echo $this->billall->user->storeno; ?>" target="_blank"><?php echo $this->billall->user->storeno; ?></a><span>|</span>
                提交时间：<?php echo $this->billall->dateCreated; ?><span>|</span>付款时间：<?php echo $this->billall->datePaid; ?></p>
        </div>
    </div>
    <div class="yundantopright">
        <p>用户ID：<?php echo $this->billall->userId; ?></p>
    </div>
    <div class="buzhou" style="clear:both">
        <div class="bzbox">
            <table>
                <tr>
                    <?php
                    $interiorall = $this->billall->InteriorCorrect;
                    foreach ($interiorall as $key => $interiorval) {
                        $billLog = Application_Model_WayLog::getByWayIdInteriorType($this->billall->id, $key);
                        ?>
                        <td <?php echo $billLog ? 'class="bz_wanl"' : ""; ?>>
                            <div class="bzloading">
                                <div class="dian"><?php echo ($billLog ? '<a href="javascript:void(0)"><i></i><span>' . $interiorval[1] : '<i></i><span>' . $interiorval[0]) . '</span></a>'; ?></div>
                                <?php if ($billLog) { ?>
                                    <div class="bzxiangbox" style="display: none;">
                                        <div class="xjiantou"></div>
                                        <div class="xianginfo">
                                            <ul>
                                                <li><label>处理时间：</label><em><?php echo $billLog->dateCreated; ?></em></li>
                                                <li><label>责任人：</label><em><?php echo $billLog->operator; ?></em></li>
                                            </ul>
                                        </div>
                                    </div>
                                <?php } ?>
                            </div>
                        </td>
                    <?php } ?>
                    <td <?php echo $this->billall->interior == Application_Model_wayBillItem::Interior_Achieve ? 'class="bz_wanr"' : ""; ?>></td>
                </tr>
            </table>
        </div>
        <div class="bzxiang"></div>
    </div>
</div>    
<div class="yundan_top">
    <table class="yunxinxi">
        <tr>
            <td class="ydleft">
                <div class="zhuangtai">
                    <i></i><h1><?php echo $this->billall->problem == Application_Model_wayBillItem::Problem_Cancel ? "取消" : $this->billall->interiorname; ?>
                        <?php if ($this->billall->problem == Application_Model_wayBillItem::Problem_Appear) { ?><em>(问题)</em><?php } ?></h1><span>[前台状态：<?php echo $this->billall->statusname; ?>]</span>
                </div>
                <div class="shouli">
                    <?php if ($this->billall->interior == Application_Model_wayBillItem::Interior_Processing) { ?>
                        <a class="anvbotton5" href="javascript:void(0)" id="hear"><span>受理</span></a>
                    <?php } ?>
                </div>
            </td>
            <td class="ydtopline">
                <div class="zhtailan">
                    <label>状态栏：</label>
                    <div class="ydtishi">
                        <?php if ($premiumFee > 0) { ?><a class="ts0" href="javascript:void(0)" title="已投保">已投保</a><?php } ?>
                        <?php if ($this->billall->isInvoice == 1) { ?><a class="ts1" href="/admini/managewaybill/preview/id/<?php echo $this->billall->id; ?>" title="已制发票" target="_blank">已制发票</a><?php } ?>
                        <?php if ($this->billall->isAddform == 1) { ?><a class="ts2" href="/admini/managewaybill/addform/id/<?php echo $this->billall->id; ?>" title="已打印地址" target="_blank">已打印地址</a><?php } ?>
                        <?php if ($this->billall->problem == Application_Model_wayBillItem::Problem_Appear) { ?><a class="ts3" href="javascript:void(0)" id='issue' title="问题包裹">问题包裹</a><?php } ?>
                        <?php if ($this->billall->problem == Application_Model_wayBillItem::Problem_Aolve || $this->billall->problem == Application_Model_wayBillItem::Problem_Cancel) { ?><a class="ts3_" href="javascript:void(0)" id='issue' title="问题包裹">问题包裹</a><?php } ?>
                        <?php if ($this->billall->interior >= Application_Model_wayBillItem::Interior_PickError && $this->billall->interior != Application_Model_wayBillItem::Interior_Achieve) { ?>
                            <a class="ts4" href="javascript:void(0)" title="预警提示">预警提示</a><?php } ?>
                        <?php if ($this->billall->interiorRemark != "" || $this->waybillRemarks) { ?><a class="ts6" href="javascript:$('#remarkUuch').click();" title="内部备注">内部备注</a><?php } ?>
                        <?php if ($this->billall->interior == Application_Model_wayBillItem::Interior_PickError) { ?><a class="ts6" href="/admini/managewaybill/picking/id/<?php echo $this->billall->id; ?>" title="拣货异常" target="_blank">拣货异常</a><?php } ?>
                    </div>
                </div>
            </td>
        </tr>
        <tr>
            <td class="ydleft">
                <table>
                    <tr>
                        <td class="xleft">运送方式：</td>
                        <td class="xlright"><?php echo $this->billall->ExpressBy->name; ?><span style="color:red;"><?= $this->billall->ExpressBy->Remark ? "(" . $this->billall->ExpressBy->Remark . ')' : '' ?></span></td>
                        <td class="xleft">物品净重：</td>
                        <td class="xlright"><?php echo ($this->billall->getWeightByType(Application_Model_WeightType::ProductWeight) / 1000); ?>kg</td>
                    </tr>
                    <tr>
                        <td class="xleft">预付款：</td>
                        <td class="xlright">
                            <em class="jiner">￥<?php echo $this->billall->getFeeByType(Application_Model_FeeType::EstimateSum); ?></em>
                            <div class="jinerxial">
                                <a class="jinerjt" href="javascript:void(0)"><span></span></a>
                                <div class="jinerxiang" style="display:none;">
                                    <ul>
                                        <li><label>国际运费：</label><span id="shipMoney"><?php echo $this->billall->getFeeByType(Application_Model_FeeType::EstimateShipFee); ?>元</span></li>
                                        <?php if ($this->billall->isCompress == 1) { ?><li><label>真空服务：</label><span><?php echo $this->billall->getFeeByType(Application_Model_FeeType::VacuumSeviceFee); ?>元</span></li><?php } ?>
                                        <?php if ($this->billall->isNoLogo == 1) { ?><li><label>去除吊牌：</label><span><?php echo $this->billall->getFeeByType(Application_Model_FeeType::RemovalFee); ?>元</span></li><?php } ?>
                                        <?php if ($this->billall->isWooden == 1) { ?><li><label>木架服务：</label><span><?php echo $this->billall->getFeeByType(Application_Model_FeeType::WoodenFee); ?>元</span></li><?php } ?>
                                        <?php if ($this->billall->getFeeByType(Application_Model_FeeType::CnShipFee) > 0) { ?><li><label>国内运费：</label><span><?php echo $this->billall->getFeeByType(Application_Model_FeeType::CnShipFee); ?>元</span></li><?php } ?>
                                        <?php if ($this->billall->getFeeByType(Application_Model_FeeType::RemoteFee) > 0) { ?><li><label>偏远费：</label><span><?php echo $this->billall->getFeeByType(Application_Model_FeeType::RemoteFee); ?>元</span></li><?php } ?>
                                        <?php if ($this->billall->getFeeByType(Application_Model_FeeType::OperateFee) > 0) { ?><li><label>操作费：</label><span><?php echo $this->billall->getFeeByType(Application_Model_FeeType::OperateFee); ?>元</span></li><?php } ?>
                                        <?php if ($this->billall->getFeeByType(Application_Model_FeeType::OversizedFee) > 0) { ?><li><label>超大费：</label><span><?php echo $this->billall->getFeeByType(Application_Model_FeeType::OversizedFee); ?>元</span></li><?php } ?>
                                        <?php
                                        if ($premiumFee > 0) {
                                            echo "<li><label>保险费：</label><span>" . $premiumFee . "元</span></li>";
                                        }
                                        ?>
                                            <?php if ($this->billall->getFeeByType(Application_Model_FeeType::FragileFee) > 0) { ?><li><label>易碎防震：</label><span><?php echo $this->billall->getFeeByType(Application_Model_FeeType::FragileFee); ?>元</span></li><?php } ?>
                                        <?php if ($this->billall->discountFee > 0) { ?><li><label>优惠券：</label><span>-<?php echo $this->billall->discountFee; ?>元</span></li><?php } ?>
                                        <?php if ($this->billall->getFeeByType(Application_Model_FeeType::ActivityDiscount) > 0) { ?><li><label>活动折扣：</label><span>
                                                    <?php echo "-" . $this->billall->getFeeByType(Application_Model_FeeType::EstimateSum) / $this->billall->getFeeByType(Application_Model_FeeType::ActivityDiscount) * (1 - $this->billall->getFeeByType(Application_Model_FeeType::ActivityDiscount)) . "元";
                                                    echo "(折扣：" . ($this->billall->getFeeByType(Application_Model_FeeType::ActivityDiscount) * 10) . "折)";
                                                    ?>
                                                </span></li><?php } ?>
                                       <?php if ($this->billall->getFeeByType(Application_Model_FeeType::ActivityDiscountCash) > 0) { ?><li><label>现金优惠：</label><span><?php echo $this->billall->getFeeByType(Application_Model_FeeType::ActivityDiscountCash); ?>元</span></li><?php } ?>
                                        <?php if (!empty($this->addPayMoney)) { ?><li style="color:red"><label>补交款：</label><span><?php echo $this->addPayMoney; ?>元</span></li><?php } ?>
                                    </ul>
                                </div>
                            </div></td>
                        <td class="xleft">预付重量：</td>
                        <td class="xlright"><?php
                            $volumeWeight = $this->billall->getWeightByType(Application_Model_WeightType::EstimateVolume);
                            $productWeight = $this->billall->getWeightByType(Application_Model_WeightType::ProductWeight);
                            $bagWeight = $this->billall->getWeightByType(Application_Model_WeightType::BagWeight);
                            if ($this->billall->ExpressBy->isVolume == 1) {
                                if ($volumeWeight > ($productWeight + $bagWeight)) {
                                    $byweight = 2;
                                    $payWeight = ($volumeWeight / 1000);
                                    echo ($volumeWeight / 1000) . "kg(体积)";
                                } else {
                                    $byweight = 1;
                                    $payWeight = (($productWeight + $bagWeight) / 1000);
                                    echo (($productWeight + $bagWeight) / 1000) . "kg(重量)";
                                    ;
                                }
                            } else {
                                $byweight = 1;
                                $payWeight = (($productWeight + $bagWeight) / 1000);
                                echo (($productWeight + $bagWeight) / 1000) . "kg(重量)";
                                ;
                            }
                            ?></td>
                    </tr>
                    <tr>
                        <td class="xleft">EORI/税号：</td>
                        <td class="xlright"><?php echo $this->billall->dutyNo == "" ? "无" : $this->billall->dutyNo; ?></td>
                        <td class="xleft">申报价值：</td>
                        <td class="xlright"><?= $this->billall->getFeeByType(Application_Model_FeeType::ReprotValue) > 0 ? '$' . $this->billall->getFeeByType(Application_Model_FeeType::ReprotValue) : '未填写' ?></td>
                    </tr>
                    <tr>
                        <td class="xleft">特殊操作：</td>
                        <td class="xlright">
                            <ul class="tscz">
                                <?php if ($this->billall->isCompress == 0 && $this->billall->isNoLogo == 0 && $this->billall->isNoSkin == 0 && $this->billall->isWooden == 0 && $this->billall->getFeeByType(Application_Model_FeeType::FragileFee) == 0) { ?>
                                    <li><i>无</i></li>
                                <?php } if ($this->billall->isNoLogo == 1) { ?>
                                    <li><i>去吊牌</i></li>
                                <?php } if ($this->billall->isNoSkin == 1) { ?>
                                    <li><i>去包装</i></li>
                                <?php } if ($this->billall->isWooden == 1) { ?>
                                    <li><i>打木架</i></li>
                                <?php } if ($this->billall->isCompress == 1) { ?>
                                    <li><i>真空</i></li>
                                <?php } if ($this->billall->getFeeByType(Application_Model_FeeType::FragileFee) > 0) { ?>
                                    <li><i>防震</i></li>
                                <?php }  ?>
                                <?php if($this->billall->getFeeByType(Application_Model_FeeType::OperateFee) > 0): ?>
                                    <li><i>操作费</i></li>
                                <?php endif; ?>
                                <?php if($this->billall->getFeeByType(Application_Model_FeeType::OversizedFee) > 0): ?>
                                    <li><i>超大费</i></li>
                                <?php endif; ?>
                                <li>
                                    <a href="javascript:void(0);" onclick="zzfwSubmit($(this))" title="添加增值补交财务信息" style="background:url('/admins/images/icons/blue_money.png');display:block;width: 16px; height: 16px;margin-top: 3px;"></a>
                                </li>
                            </ul>

                        </td>
                        <td class="xleft">是否投保：</td>
                        <td class="xlright"><?php
                            if ($premiumFee > 0) {
                                echo '(投保价值:<span id="premiumFee">' . $this->billall->getFeeByType(Application_Model_FeeType::PremiumValue) . '</span>元)';
                            } else {
                                echo '未投保';
                            }
                            ?></td>
                    </tr>
<?php $shangyiLog = Application_Model_WayLog::getByWayIdInteriorType($this->billall->id, Application_Model_WayLog::Type_PropertySY); ?>
                    <tr class="showProperty" style="<?php echo $shangyiLog ? "" : "display:none;"; ?>">
                        <td class="xleft">包裹属性：</td>
                        <td class="xlright"><span class="span_showProperty"><?php echo $shangyiLog ? $shangyiLog->description : ""; ?></span></td>
                        <td class="xleft"></td>
                        <td class="xlright"></td>
                    </tr>
                </table>
            </td>
            <td class="ydtopline sdq" rowspan="2">
                <table class="yddizhi">
                    <tr>
                        <td class="dzl">收件姓名：</td>
                        <td><?php echo htmlspecialchars($this->billall->consignee); ?></td>
                    </tr>
                    <tr>
                        <td class="dzl">目的国家：</td>
                        <td><?php echo $this->billall->UserCity->name . '(' . $this->billall->UserCity->ename . ')'; ?></td>
                    </tr>
                    <tr>
                        <td class="dzl">邮政编码：</td>
                        <td><?php echo htmlspecialchars($this->billall->conPostCode); ?></td>
                    </tr>
                    <tr>
                        <td class="dzl">详细地址：</td>
                        <td><?php echo htmlspecialchars($this->billall->conAdd); ?></td>
                    </tr>
                    <tr>
                        <td class="dzl">联系电话：</td>
                        <td><?php echo htmlspecialchars($this->billall->conTel); ?></td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <tr <?php echo $this->Waybill ? "" : "style='display:none;'" ?>>
                            <td colspan="3" style="padding-left: 20px;color: #c00;">
                               风险审核：暂停此用户的所有服务！
                            </td>
            </tr>

            <tr <?php echo $this->waypaybill ? "" : "style='display:none;'" ?>>
                            <td colspan="3" style="padding-left: 20px;color: #c00;">
                               客户第一次国际信用卡支付，24小时风险审核后自动解除服务限制！
                            </td>
            </tr>

            <td class="ydleft">
                <table>
                    <tr>
                        <td class="xleft">备注：</td>
                        <td><?php echo htmlspecialchars($this->billall->remark); ?></td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
</div>

<div class="ydbottom">
<?php if ($this->billall->interiorRemark || $this->waybillRemarks) { ?>
        <div class="youqiliuyan">
            <div class="lanmu">
                <h2>运单内部备注</h2>
            </div>
            <div class="yqly">
                <?php echo $this->billall->interiorRemark; ?>

    <?php if ($this->waybillRemarks): ?>
                    <table>
                        <tbody>
        <?php foreach ($this->waybillRemarks as $_remark): ?>
                                <tr>
                                    <td><?php echo $_remark->operator ?>在 <?php echo $_remark->createdAt ?> 留言：</td>
                                    <td><?php echo $_remark->content; ?></td>
                                    <td style="padding:0 0 0 38px;"><a href="javascript:void(0)" title="删除该备注" onclick="javascript:deleteWaybillRemark($(this),<?php echo $_remark->id ?>)">删除</a></td>
                                </tr>
        <?php endforeach; ?>
                        </tbody>
                    </table>
    <?php endif; ?>
            </div>
        </div>
    <?php } ?>
<?php if ($this->billall->user->remark) { ?>
        <div class="youqiliuyan">
            <div class="lanmu">
                <h2>用户备注</h2>
            </div>
            <div class="yqly">
    <?php echo "<p><b>用户备注：</b>" . $this->billall->user->remark . "</p>"; ?>

            </div>
        </div>
    <?php } ?>
<?php $setting = Application_Model_ServiceSetting::getByInfo($this->billall->user->id,Application_Model_ServiceSetting::Type_Waybill); ?>
<?php if ($setting) { ?>
        <div class="youqiliuyan">
            <div class="lanmu">
                <h2>运单设置</h2>
            </div>
            <div class="yqly">
        <?php foreach($setting as $_set){
            $str = '';
            $mon = '';
            if($_set->value == 1){
                $mon = '20元以内';
            }elseif($_set->value == 2){
                $mon = '50元以内';
            }elseif($_set->value == 3){
                $mon = '100元以内';
            }elseif($_set->value == 4){
                $mon = '200元以内';
            }elseif($_set->value == 2){
                $mon = '300元以内';
            }elseif($_set->value == 2){
                $mon = '不设限';
            }
            if($_set->setting == 1){
                if($_set->option == 1){
                    $str = "授权悠奇在我选定的金额内用余额补差价：$mon";
                }elseif($_set->option == 2){
                    $str = "直接取消此国际运单并退款";
                }elseif($_set->option == 3){
                    $str = "提示我，自己根据情况决定";
                }
                echo "运单重量上升导致运费增加希望悠奇如何处理？：$str<br>";
            }elseif($_set->setting == 2){
                if($_set->option == 1){
                    $str = "同渠道拆分多个运单发送，授权悠奇在我选定的金额内用余额补差价：$mon";
                }elseif($_set->option == 2){
                    $str = "自动更换可以运输且金额相近的渠道，并授权扣款。：$mon";
                }elseif($_set->option == 3){
                    $str = "直接取消此国际运单并退款";
                }elseif($_set->option == 4){
                    $str = "提示我，自己根据情况决定";
                }
                echo "包裹重量和尺寸超出所选渠道规定范围如何处理？：$str";
            }
        } ?>
            </div>
        </div>
    <?php } ?>


<?php if ($this->billall->interior >= Application_Model_wayBillItem::Interior_Confrimed) { ?>
        <div class="chuku">
            <div class="lanmu">
                <h2>出库流程</h2>
            </div>
    <?php if ($this->billall->interior == Application_Model_wayBillItem::Interior_Confrimed && ($this->billall->problem != Application_Model_wayBillItem::Problem_Appear && $this->billall->problem != Application_Model_wayBillItem::Problem_Cancel)) { ?>
                <div class="lcbox">
                    <table class="lcks" >
                        <tr>
                            <td class="lcleft"><p>待选择渠道</p></td>
                            <td>
                                <form method="post" action="/admini/managewaybill/affirmshipchannel/id/<?php echo $this->billall->id; ?>?_rf=<?= urlencode($this->referer) ?>" id="formshipchanner">
                                    <div class="qudao">
                                        <dl>
                                            <dt>代理商选择：</dt>
                                            <dd>
                                                <?php foreach ($this->agentcomp as $key => $agentcomp) { ?>
                                                    <label><input type="radio" name="agentid" class="agentid" value="<?php echo $agentcomp->id; ?>"/><?php echo $agentcomp->name; ?></label>
        <?php } ?>
                                            </dd>
                                        </dl>
                                        <dl>
                                            <dt>发货渠道：</dt>
                                            <dd>
                                                <select name="channer" id="channer">
                                                </select><label class="suoyou"><input name="radioChannel" id="radioChannel" type="checkbox" value="">所有</label>
                                            </dd>
                                        </dl>
        <?php //if ($this->billall->expressId == Application_Model_Express::Express_Eub || $this->billall->expressId == Application_Model_Express::Express_AEub) {  ?>
                                        <dl class="eubAddress" style="<?php echo($this->billall->expressId == Application_Model_Express::Express_Eub || $this->billall->expressId == Application_Model_Express::Express_AEub) ? "" : "display:none;"; ?>">
                                            <dt><span style="color:#c00;" class="startbag"></span>收件人城市：</dt>
                                            <dd>
                                                <div class="textbox"><input class="textinput" type="text" id="city" name="city"/></div>
                                            </dd>
                                            <dt><span style="color:#c00;" class="startbag"></span>收件人州：</dt>
                                            <dd>
                                                <div class="textbox"><input class="textinput" type="text" id="province" name="province"/></div>
                                            </dd>
                                        </dl>
        <?php //}  ?>  
                                        <div class="lctijiao">
                                            <input type="hidden" id="billid" name="billid" value="<?php echo $this->billall->id; ?>" />
                                            <input type="hidden" id="operate" name="operate" value="examine" />
                                            <a class="anvbotton5" href="javascript:$('#formshipchanner').submit();" id="shipchanner"><span>确认</span></a>
                                            <?php //if ($this->billall->AgentId == Application_Model_AgentCompany::Agent_4px) {  ?>
                                            <a href="javascript:void(0)" id="ship4px" class="anvbotton5" style="margin-left:20px;display: none;"><span>上传递四方</span></a>
                                            <?php //} ?>
                                            <?php // var_dump(($this->billall->expressId == 9 || $this->billall->expressId == 13 || $this->billall->expressId == 35 || $this->billall->expressId == 36) ); ?>
                                            <a href="javascript:void(0)" id="shipEub" class="anvbotton5" style="margin-left:20px;<?php echo ($this->billall->expressId == 9 || $this->billall->expressId == 13 || $this->billall->expressId == 35 || $this->billall->expressId == 36)?"":"display:none;"; ?>"><span>上传E邮宝</span></a>
        <?php //}  ?>  
                                        </div>
                                    </div>

                                    <div class="qudaojiage">
                                        <div class="jglan">
                                            <h3><?php echo ($payWeight) . "kg - " . $this->billall->ExpressBy->name; ?>各渠道价格对比</h3>
                                            <div class="qitaqd">
                                                <label>其他方式：</label>
                                                <select name="editshiptype" id="editshiptype">
                                                    <?php foreach ($this->allshiptype as $eccomp) { ?>
                                                        <option value="<?php echo $eccomp->id; ?>" <?php echo $eccomp->id == $this->billall->expressId ? "selected" : ""; ?>><?php echo $eccomp->name; ?></option>
        <?php } ?>
                                                </select>
                                            </div>
                                        </div>
                                        <table id="agentChannelCostPrice">

                                        </table>
                                        <p><a href="#">默认显示5条，点击查看全部</a></p>
                                    </div>
                                </form>    
                            </td>
                        </tr>
                    </table>
                </div>
            <?php } ?>
    <?php if ($this->billall->interior >= Application_Model_wayBillItem::Interior_Incoice) { ?>
                <div class="lcbox">
                    <table class="lcwc">
                        <tr>
                            <td class="lcleft">
                                <p class="yixz"><i></i>已选择渠道</p>
                            </td>
                            <td>
                                <div class="qudao">
                                    <dl>
                                        <dt>渠道商选择：</dt>
                                        <dd><?php echo $this->billall->agentcompname ? $this->billall->agentcompname->name : ""; ?></dd>
                                    </dl>
                                    <dl>
                                        <dt>快递方式：</dt>
                                        <dd><?php echo $this->billall->channelname ? $this->billall->channelname->name : ""; ?>
                                        </dd>
                                    </dl>
                                </div>
                            </td>
                        </tr> 
                    </table>
                </div>
            <?php } ?>
    <?php if ($this->billall->interior == Application_Model_wayBillItem::Interior_Incoice && ($this->billall->problem != Application_Model_wayBillItem::Problem_Appear && $this->billall->problem != Application_Model_wayBillItem::Problem_Cancel)) { ?>
                <div class="lcbox">
                    <table class="lcwc">
                        <tr>
                            <td class="lcleft"><p>待拣货</p></td>
                            <td>
                                <div class="qudao">
                                    <p class="sming">请打印好清单、地址标签、发票等单据进行拣货！</p>
                                    <div class="lctijiao">
                                        <a href="javascript:void(0)" id="pick" class="anvbotton5"><span>设为已拣货</span></a>
                                    </div>
                                </div>
                            </td>
                        </tr>
                    </table>
                </div>
            <?php } ?>
    <?php if ($this->billall->interior == Application_Model_wayBillItem::Interior_PickError && ($this->billall->problem != Application_Model_wayBillItem::Problem_Appear && $this->billall->problem != Application_Model_wayBillItem::Problem_Cancel)) { ?>
                <div class="lcbox">
                    <table class="lcwc">
                        <tr>
                            <td class="lcleft"><p>待拣货</p></td>
                            <td>
                                <div class="qudao">
                                    <p class="sming buzc">[拣货异常] 以下物品暂时无法找到</p>
                                    <table class="jhyc">
                                        <tr>
                                            <th>物品编号</th>
                                            <th>状态</th>
                                            <th>操作</th>
                                        </tr>
                                        <?php
                                        if ($this->storedetail != '') {
                                            foreach ($this->storedetail as $storeItem) {
                                                if ($storeItem->status == Application_Model_WayItem::Status_Lose) {
                                                    $Item = $storeItem->StoreIdByItem;
                                                    ?>
                                                    <tr>
                                                        <td><a class="ycwpbh" href="/admini/managestore/storedetail/id/<?php echo $Item->id; ?>" target="_blank"><?php echo $Item->barcode; ?></a></td>
                                                        <td>无法找到</td>
                                                        <td><a href="/admini/managewaybill/picking/id/<?php echo $this->billall->id; ?>" class="anvbotton2"><span>已找到</span></a></td>
                                                    </tr>
                                                    <?php
                                                }
                                            }
                                        }
                                        ?>
                                    </table>
                                    <div class="lctijiao">
                                        <a href="javascript:void(0)" id="pick" class="anvbotton5"><span>设为已拣货</span></a>
                                    </div>
                                </div>
                            </td>
                        </tr>
                    </table>
                </div>
            <?php } ?>  
    <?php if ($this->billall->interior >= Application_Model_wayBillItem::Interior_Picking && $this->billall->interior != Application_Model_wayBillItem::Interior_PickError) { ?>
                <div class="lcbox">
                    <table class="lcwc">
                        <tr>
                            <td class="lcleft">
                                <p class="yixz"><i></i>已拣货</p>
                            </td>
                            <td>
                                <div class="qudao">
                                    <dl>
                                        <dt>是否正常：</dt>
                                        <dd>正常</dd>
                                    </dl>
                                </div>
                            </td>
                        </tr>
                    </table>
                </div>
            <?php } ?>
    <?php if ($this->billall->interior == Application_Model_wayBillItem::Interior_Picking && ($this->billall->problem != Application_Model_wayBillItem::Problem_Appear && $this->billall->problem != Application_Model_wayBillItem::Problem_Cancel)) { ?>
                <div class="lcbox">
                    <form method="post" action="/admini/managewaybill/affirmpicking/id/<?php echo $this->billall->id; ?>?_rf=<?= urlencode($this->referer) ?>" id="formshipment">
                        <table class="lcks" >
                            <tr>
                                <td class="lcleft"><p>待打包</p></td>
                                <td>
                                    <div class="qudao" style="width:880px;">
                                        <dl>
                                            <dt>渠道单号：</dt>
                                            <dd>
                                                <div class="textbox"><input class="textinput w250" type="text" id="agentNo" name="agentNo" value="<?php echo $this->billall->agentNo; ?>"/></div>
                                            </dd>
                                        </dl>
                                        <dl>
                                            <dt>包裹数量：</dt>
                                            <dd>
                                                <div class="textbox"><input class="textinput" type="text" id="waynum" name="waynum" value="1" onkeyup="value = value.replace(/[^\d]/g, '')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))"/></div>
                                            </dd>
                                        </dl>
                                        <dl class="bag_1">
                                            <dt><span style="color:#c00;" class="startbag"></span>重量：</dt>
                                            <dd>
                                                <div class="textbox"><input class="textinput" type="text" id="forecastWeight_1" name="forecastWeight_1"/></div><span>kg</span>
                                            </dd>
                                            <dt>尺寸：</dt>
                                            <dd>
                                                <div class="chicun">
                                                    <input class="textinput w30 forecastinput" i="1" type="text" id="forecastlength_1" name="forecastlength_1" onkeyup="value = value.replace(/[^\d]/g, '')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" /><i>X</i>
                                                    <input class="textinput w30 forecastinput" i="1" type="text" id="forecastwidth_1" name="forecastwidth_1" onkeyup="value = value.replace(/[^\d]/g, '')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" /><i>X</i>
                                                    <input class="textinput w30 forecastinput" i="1" type="text" id="forecastheight_1" name="forecastheight_1" onkeyup="value = value.replace(/[^\d]/g, '')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" /><span>CM</span></div>
                                                <input type="hidden" id="forecastvolumeWeight_1" name="forecastvolumeWeight_1" value="0">
                                                <span class="tijizl tjzl_1"></span>
                                            </dd>
                                        </dl>
                                        <div class="lctijiao" style="float: left;">
                                            <input type="hidden" id="billid" name="billid" value="<?php echo $this->billall->id; ?>" />
                                            <input type="hidden" id="operate" name="operate" value="singment" />
                                            <a href="javascript:void(0)" id="shipment" class="anvbotton5" ><span>设为已打包</span></a>
                                        </div>
                                    </div>
                                    <input type="hidden" id="express_model_isvolume" value="<?php echo $this->billall->ExpressChannelBy->isVolume ?>" />
                                    <input type="hidden" id="express_lack_money" />
                                    <script type="text/javascript">
                                        $(function() {
                                            //                                            $('#forecastWeight_1').bind('blur',function(){
                                            //                                                var weight = $(this).val(),
                                            //                                                    price = cultfeeShippingPrice(weight),
                                            //                                                    esShippingFee = <?php echo $this->billall->getFeeByType(Application_Model_FeeType::EstimateShipFee); ?>;
                                            //                                                if(price){
                                            //                                                    var priceStr = '',
                                            //                                                        lackMoney = price - esShippingFee;
                                            //                                                    if(0 < lackMoney){
                                            //                                                        priceStr = price + '元,需要补交' +　lackMoney　+ '元';
                                            //                                                        $('#express_lack_money').val(lackMoney);
                                            //                                                    }else{
                                            //                                                        priceStr = price + '元';
                                            //                                                    }
                                            //                                                    var priceHtml = '<dl id="ExpressChannelByPrice"><dt>运费：</dt><dd><div class="textbox">'+priceStr+'</div></dd></dl>';
                                            //                                                    if(0 >= $('#ExpressChannelByPrice').length){
                                            //                                                        $(this).closest('.qudao').children('.lctijiao').before(priceHtml);
                                            //                                                    }else{
                                            //                                                        $('#ExpressChannelByPrice .textbox').text(priceStr);
                                            //                                                    }
                                            //                                                    
                                            //                                                }
                                            //                                            });
                                        });


                                    </script>
                                </td>
                            </tr>
                        </table>
                    </form>
                </div>
            <?php } ?>
            <?php if ($this->billall->interior >= Application_Model_wayBillItem::Interior_Pick && $this->billall->interior != Application_Model_wayBillItem::Interior_PickError) { ?>
                <?php
                $ckweight = false;
                if ($byweight == 1) {
                    if ($this->firstWeight) {
                        $ckweight = ($this->firstWeight->weight / 1000) > $payWeight ? true : false;
                    }
                } else {
                    if ($this->firstvolumeWeight) {
                        $ckweight = ($this->firstvolumeWeight->weight / 1000) > $payWeight ? true : false;
                    }
                }
                ?>
                <div class="lcbox">
                    <table class="lcwc">
                        <tr>
                            <td class="lcleft">
                                <p class="yixz"><i></i>已打包</p>
                            </td>
                            <td>
                                <div class="qudao">
                                    <dl>
                                        <dt>渠道单号：</dt>
                                        <dd><?php
                                            echo $this->billall->agentNo;
                                            if ($this->billall->agentNo == $this->billall->logistics) {
                                                ?><em>[原单]</em><?php } ?></dd>
                                    </dl>
                                    <?php if (count($this->billall->SplitWeight) > 0) { ?>
                                        <?php
                                        foreach ($this->billall->SplitWeight as $key => $split) {
                                            $bagVolume = number_format($split->Length * $split->Width * $split->Height / 5000, 2);
                                            ?>
                                            <dl>
                                                <dt><span style="color:#999;"><?php echo ($key + 1) . "/" . count($this->billall->SplitWeight); ?></span>重量：</dt><dd><div class="textbox"><?php echo number_format($split->Weight / 1000, 2); ?></div><span>kg</span></dd>
                                                <dt>尺寸：</dt><dd><div class="chicun"><?php echo $bagVolume > 0 ? $split->Length . "&nbsp;*&nbsp;" . $split->Width . "&nbsp;*&nbsp;" . $split->Height . '&nbsp;CM' : "无"; ?></div><span class="tijizl"><?php echo $bagVolume > 0 ? "[体积重量为 = " . $bagVolume . "kg]" : ""; ?></span></dd></dl>      
                                        <?php } ?>
                                        <?php } ?>
                                    <dl style="color:#f60;">
                                        <?php $bagTotalWeight = $this->firstWeight ? $this->firstWeight->weight / 1000 : 0; ?>
        <?php $bagVolumeWeight = 0; ?>
                                        <dt>包裹总重量：</dt>
                                        <dd><?php echo $bagTotalWeight; ?>kg</dd>
        <?php echo count($this->billall->SplitWeight) == 0 ? "</dl><dl>" : ""; ?>
                                        <dt>总体积重量：</dt>
                                        <dd><?php
                                            $volumLog = Application_Model_WayLog::getByWayIdInteriorType($this->billall->id, Application_Model_WayLog::Type_BillVolume);
                                            if ($this->firstvolumeWeight) {
                                                $bagVolumeWeight = ($this->firstvolumeWeight && $this->firstvolumeWeight->weight != 0) ? ($this->firstvolumeWeight->weight / 1000) : 0;
                                                echo $bagVolumeWeight ? $bagVolumeWeight . "kg" : "";
                                            } else {
                                                echo "无";
                                            }
                                            ?></dd>
                                    </dl>
                                    <?php
                                    $channer = 0;
                                    if ($this->billall->channer) {
                                        $channer = $this->billall->channer;
                                    }
                                    $channel = Application_Model_ExpressChannel::load($channer);
                                    $expressChannelBy = Application_Model_Express::load($channel->expressId);
                                    ?>
                                    <?php if ($expressChannelBy->isVolume && $bagTotalWeight < $bagVolumeWeight): ?>
                                        <?php $bagWeight = $bagVolumeWeight; ?>
                                    <?php else: ?>
                                        <?php $bagWeight = $bagTotalWeight; ?>
                                    <?php endif; ?>
                                    <?php
                                    $bagWeightShipFees = Application_Model_ExpressPrice::getPricesByCity($this->billall->state);
                                    $bagWeightShipFee = 0;


                                    if ($expressChannelBy) {

                                        foreach ($bagWeightShipFees as $_shipFee) {
                                            if ($_shipFee->expressId == $expressChannelBy->Id) {
                                                $bagWeightShipFee = $_shipFee->getMoneyByweight($bagWeight * 1000);
                                                break;
                                            }
                                        }
                                    }

                                    $estimateShipFee = $this->billall->getFeeByType(Application_Model_FeeType::EstimateShipFee);
                                    ?>
                                    <?php $estimateReFee = number_format(($bagWeightShipFee - $estimateShipFee), 2); ?>
                                    <?php if ($estimateReFee > 0): ?>
                                        <?php
                                        $params = array(
                                            'business_type' => 'zltjbj',
                                            'trader' => 'account-number-cr',
                                            'amount' => $estimateReFee,
                                            'type' => 'waybill',
                                            'orderSn' => $this->billall->billNo,
                                            'stockNo' => $this->billall->user->storeno,
                                            'member' => 'admin',
                                            'attribute' => json_encode(array(
                                                'channel_no' => $this->billall->agentNo,
                                                'channel' => $expressChannelBy->name,
                                                'orgin_ship_fee' => $this->billall->getFeeByType(Application_Model_FeeType::EstimateShipFee),
                                                'weight' => ($this->billall->getWeightByType(Application_Model_WeightType::ProductWeight) + $this->billall->getWeightByType(Application_Model_WeightType::BagWeight)) / 1000,
                                                'volume' => $this->billall->getWeightByType(Application_Model_WeightType::EstimateVolume) / 1000,
                                                'new_weight' => $bagTotalWeight,
                                                'new_volume' => $bagVolumeWeight,
                                                'new_ship_fee' => $estimateReFee
                                            ))
                                        );
                                        ?>
                                        <dl>
                                            <dt>当前运费：</dt><dd><?php echo $bagWeightShipFee ?>元</dd>
                                            <dt>需要补交：</dt><dd><form action="http://fin.uuch.com//backend/admin/uuchfinance_transaction/new" method="post" target="_blank"><?php echo $estimateReFee ?>元 
                                                    <a href="javascript:void(0);" onclick="javascript:$(this).closest('form').submit();" title="添加财务信息" style="background:url('/admins/images/icons/blue_money.png');" name="57377">&nbsp;&nbsp;&nbsp;&nbsp;</a>
                                                    <input type='hidden' name="finance_transaction_params" value='<?php echo json_encode($params); ?>' />
                                                </form></dd>
                                        </dl>
                                    <?php endif; ?>
                                </div>
                            </td>
                        </tr>
                    </table>
                </div>
            <?php } ?>
            <?php if ($this->billall->interior == Application_Model_wayBillItem::Interior_Pick && ($this->billall->problem != Application_Model_wayBillItem::Problem_Appear && $this->billall->problem != Application_Model_wayBillItem::Problem_Cancel)) { ?>
                <div class="lcbox">
                    <table class="lcwc">
                        <tr>
                            <td class="lcleft"><p>待确认渠道</p></td>
                            <td>
                                <div class="qudao" id="indexqudao">
                                    <p class="sming" <?php echo $ckweight ? "style='color:#c00'" : ""; ?>>请根据打完包的重量确认渠道选择是否合理！</p>
                                    <div class="lctijiao">
                                        <ul>
                                            <li><a href="javascript:void(0)" class="anvbotton5" id="affirmqudao"><span>已确认</span></a></li>
                                            <li><a href="javascript:void(0)" class="anvbotton6" id="editchannel"><span>修改渠道</span></a></li>
                                        </ul>
                                    </div>
                                </div>
                                <form style="display:none;" method="post" action="/admini/managewaybill/affirmeditchannel/id/<?php echo $this->billall->id; ?>?_rf=<?= urlencode($this->referer) ?>" id="formshipchanner">
                                    <div class="qudao">

                                        <dl>
                                            <dt>修改渠道商：</dt>
                                            <dd>
                                                <?php foreach ($this->agentcomp as $key => $agentcomp) { ?>
                                                    <label><input name="agentid" class="agentid" type="radio" value="<?php echo $agentcomp->id; ?>" /><?php echo $agentcomp->name; ?></label>
                                                <?php } ?>
                                            </dd>
                                        </dl>
                                        <dl>
                                            <dt>修改快递方式：</dt>
                                            <dd>
                                                <select name="channer" id="channer">    
                                                </select><label class="suoyou"><input name="radioChannel" id="radioChannel" type="checkbox" value="">所有</label>
                                            </dd>
                                        </dl>
                                        <dl class="eubAddress" style="<?php echo($this->billall->expressId == Application_Model_Express::Express_Eub || $this->billall->expressId == Application_Model_Express::Express_AEub) ? "" : "display:none;"; ?>">
                                            <dt><span style="color:#c00;" class="startbag"></span>收件人城市：</dt>
                                            <dd>
                                                <div class="textbox"><input class="textinput" type="text" id="city" name="city"/></div>
                                            </dd>
                                            <dt><span style="color:#c00;" class="startbag"></span>收件人州：</dt>
                                            <dd>
                                                <div class="textbox"><input class="textinput" type="text" id="province" name="province"/></div>
                                            </dd>
                                        </dl>
                                        <div class="lctijiao">
                                            <input type="hidden" id="billid" name="billid" value="<?php echo $this->billall->id; ?>" />
                                            <input type="hidden" id="operate" name="operate" value="examine" />
                                            <a class="anvbotton5" href="javascript:void(0)" id="shipchanner"><span>确认</span></a>
                                            <a href="javascript:void(0)" id="ship4px" class="anvbotton5" style="margin-left:20px;display: none;"><span>上传递四方</span></a>
                                            <a href="javascript:void(0)" id="shipEub" class="anvbotton5" style="margin-left:20px;<?php echo ($this->billall->expressId == 9 || $this->billall->expressId == 13 || $this->billall->expressId == 35 || $this->billall->expressId == 36)?"":"display:none;"; ?>"><span>上传E邮宝</span></a>
                                            <a href="javascript:void(0)" style="margin-left:50px;" class="anvbotton6" id="cancelEdit"><span>取消修改</span></a>
                                        </div>
                                    </div>
                                    <div class="qudaojiage">
                                        <div class="jglan">
                                            <h3><?php echo ($this->getWeight ? $this->getWeight : 0) . "kg - " . $this->billall->ExpressBy->name; ?>各渠道价格对比</h3>
                                            <div class="qitaqd">
                                                <label>其他方式：</label>
                                                <select name="editshiptype" id="editshiptype">
                                                    <?php foreach ($this->allshiptype as $eccomp) { ?>
                                                        <option value="<?php echo $eccomp->id; ?>" <?php echo $eccomp->id == $this->billall->expressId ? "selected" : ""; ?>><?php echo $eccomp->name; ?></option>
                                                    <?php } ?>
                                                </select>
                                            </div>
                                        </div>
                                        <table id="agentChannelCostPrice">

                                        </table>
                                        <p><a href="#">默认显示5条，点击查看全部</a></p>
                                    </div>
                                </form>
                            </td>
                        </tr>
                    </table>
                </div>
            <?php } ?>
            <?php if ($this->billall->interior >= Application_Model_wayBillItem::Interior_AffirmChannel && $this->billall->interior != Application_Model_wayBillItem::Interior_PickError) { ?>
                <div class="lcbox">
                    <table class="lcwc">
                        <tr>
                            <td class="lcleft">
                                <p class="yixz"><i></i>已确认渠道</p>
                            </td>
                            <td>
                                <?php
                                $agentLog = Application_Model_WayLog::getByWayIdInteriorType($this->billall->id, Application_Model_WayLog::Type_BillAffirmAgent);
                                $channelLog = Application_Model_WayLog::getByWayIdInteriorType($this->billall->id, Application_Model_WayLog::Type_BillAffirmChannel);
                                if ($agentLog && $channelLog) {
                                    ?>
                                    <div class="qudao">
                                        <dl>
                                            <dt>渠道修改为：</dt>
                                            <dd><?php echo $agentLog->DescriptionByAgent->name; ?></dd>
                                        </dl>
                                        <dl>
                                            <dt>快递修改为：</dt>
                                            <dd><?php echo $channelLog->DescriptionByChannel->name; ?></dd>
                                            <dd><a class="setHandwork" id="setHandwork" href="javascript:void(0)" title="手工入账" style="background:url('/admins/images/icons/blue_money.png');" name="57377">&nbsp;&nbsp;&nbsp;&nbsp;</a></dd>
                                        </dl>

                                    </div>
                                <?php } else { ?>
                                    <div class="qudao">
                                        <dl>
                                            <dt>是否确认：</dt>
                                            <dd>已确认</dd>
                                        </dl>
                                    </div>
                                <?php } ?>
                                <script type="text/javascript">
                                    $(function() {
                                        $('#setHandwork').bind('click', function() {
                                            $("div.houtai_overlay").show();
                                            $("div.finance-work").css({
                                                'width': '760px',
                                                'height': '600px'
                                            });
                                            $("div.houtai_overlay").css('z-index', '9999');
                                            $("div.finance-work").css('z-index', '10000');
                                            $("div.finance-work").show();
                                        })
                                        $('#finance-cancel').bind('click', function() {
                                            $("div.houtai_overlay").hide();
                                            $("div.finance-work").hide();
                                        });

                                        $('#subFinance').bind('click', function() {
                                            $(this).unbind('click');
                                            $(this).children('span').text('确认中...');
                                            var formFrame = $(this).closest('#handworkConent'),
                                                    inputs = formFrame.find('input[type="text"]');
                                            var data = {};
                                            for (var i = 0; i < inputs.length; i++) {
                                                if (!inputs.eq(i).val()) {
                                                    alert('所有选项必须输入内容...');
                                                    return false;
                                                }
                                                data[inputs.eq(i).attr('name')] = inputs.eq(i).val();
                                            }
                                            $.ajax({
                                                url: '/admini/managewaybill/addfinance/id/<?php echo $this->billall->id; ?>',
                                                type: 'POST',
                                                data: data,
                                                success: function(data) {
                                                    if (data.code == 'success') {
                                                        alert('手工入账成功')
                                                    } else {
                                                        alert(data.message);
                                                    }

                                                    location.reload();
                                                }
                                            });


                                        })
                                    })
                                </script>
                            </td>
                        </tr>
                    </table>
                </div>
            <?php } ?>
            <?php if ($this->billall->interior == Application_Model_wayBillItem::Interior_AffirmChannel && ($this->billall->problem != Application_Model_wayBillItem::Problem_Appear && $this->billall->problem != Application_Model_wayBillItem::Problem_Cancel)) { ?>
                <div class="lcbox">
                    <table class="lcwc">
                        <tr>
                            <td class="lcleft"><p>待交运</p></td>
                            <td>
                                <div class="qudao">
                                    <p class="sming">请打印并确认好交接单，等待渠道商取货！</p>
                                    <div class="lctijiao"><a href="javascript:void(0)" class="anvbotton5" id="affirmjiao"><span>设为已交运</span></a></div>
                                </div>
                            </td>
                        </tr>
                    </table>
                </div>
            <?php } ?>
            <?php if ($this->billall->interior >= Application_Model_wayBillItem::Interior_Outstorage && $this->billall->interior != Application_Model_wayBillItem::Interior_PickError) { ?>
                <div class="lcbox">
                    <table class="lcwc">
                        <tr>
                            <td class="lcleft">
                                <p class="yixz"><i></i>已交运</p>
                            </td>
                            <td>
                                <div class="qudao">
                                    <dl>
                                        <dt>是否交运：</dt>
                                        <dd>已交运</dd>
                                    </dl>
                                </div>
                            </td>
                        </tr>
                    </table>
                </div>
            <?php } ?>

        </div>
    <?php } ?>

    <?php if ($this->billall->interior >= Application_Model_wayBillItem::Interior_Outstorage && $this->billall->interior != Application_Model_wayBillItem::Interior_PickError) { ?>
        <div class="yunshu">
            <div class="lanmu">
                <h2>运输流程</h2>
            </div>

            <?php if (($this->billall->interior == Application_Model_wayBillItem::Interior_Outstorage || $this->billall->interior == Application_Model_wayBillItem::Interior_OverSystem) && ($this->billall->problem != Application_Model_wayBillItem::Problem_Appear && $this->billall->problem != Application_Model_wayBillItem::Problem_Cancel)) { ?>
                <div class="lcbox">
                    <table class="lcks" >

                        <tr>
                            <td class="lcleft"><p>待入系统</p></td>
                            <td style="position:relative;">
                                <form method="post" action="/admini/managewaybill/affirmsystem/id/<?php echo $this->billall->id; ?>?_rf=<?= urlencode($this->referer) ?>" id="formshipleno">
                                    <div class="qudao">
                                        <dl>
                                            <dt>结算重量：</dt>
                                            <dd>
                                                <div class="textbox"><input class="textinput w250" type="text"  id="lastWeight" name="lastWeight" value="<?php echo $this->billall->lastWeight ? $this->billall->lastWeight / 1000 : ""; ?>"/></div><span class="ksd">kg</span>
                                            </dd>
                                        </dl>
                                        <dl>
                                            <dt>包裹尺寸：</dt>
                                            <dd>
                                                <div class="chicun">
                                                    <input class="textinput w30" type="text" id="length" name="length"  onkeyup="value = value.replace(/[^\d]/g, '')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" /><i>X</i>
                                                    <input class="textinput w30" type="text" id="width" name="width"  onkeyup="value = value.replace(/[^\d]/g, '')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" /><i>X</i>
                                                    <input class="textinput w30" type="text" id="height" name="height"  onkeyup="value = value.replace(/[^\d]/g, '')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" /><span>CM</span></div>
                                            </dd>
                                        </dl>
                                        <dl>
                                            <dt>结算体积：</dt>
                                            <dd>
                                                <div class="textbox"><input class="textinput w250" type="text" id="lastVolumeWeight" name="lastVolumeWeight" value="<?php echo $this->billall->lastVolumeWeight ? $this->billall->lastVolumeWeight / 1000 : ""; ?>" /></div>
                                                <span class="ksd">kg</span><div class="jisuan"><a href="javascript:void(0)" id="ckmoney" class="anvbotton3">计算金额</a></div>
                                            </dd>
                                        </dl>
                                        <dl>
                                            <dt>运费金额：</dt>
                                            <dd>
                                                <ul>
                                                    <li><div class="textbox"><input class="textinput w80" type="text" id="lastMoney" name="lastMoney"/></div><span class="ksd">元</span></li>
                                                    <li><span class="jstuikuan">退款：</span><div class="textbox"><input class="textinput w80" type="text" name="refundMoney" id="refundMoney"/></div><span class="ksd">元</span>
                                                        （原运费：<?php echo $this->billall->getFeeByType(Application_Model_FeeType::EstimateShipFee); ?>）
                                                    </li>
                                                </ul>
                                            </dd>
                                        </dl>
                                        <div class="lctijiao">
                                            <input type="hidden" id="billid" name="billid" value="<?php echo $this->billall->id; ?>" />
                                            <a href="javascript:void(0)" class="anvbotton5" id="shipleno"><span>设为已入系统</span></a>
                                        </div>
                                    </div>
                                </form>
                                <form action="http://fin.uuch.com/backend/admin/uuchfinance_transaction/new" method="post" target="_blank">
                                    <?php
                                    $pyffinanceParams = array(
                                        'business_type' => 'pyfbj',
                                        'trader' => 'account-number-cr',
                                        'type' => 'waybill',
                                        'orderSn' => $this->billall->billNo,
                                        'stockNo' => $this->billall->user->storeno,
                                        'member' => 'admin',
                                        'attribute' => json_encode(array(
                                            'orgin_remote_fee' => 0,
                                            'now_remote_fee' => 0
                                        ))
                                    );
                                    ?>
                                    <a href="javascript:void(0);" onclick="javascript:$(this).closest('form').submit();" title="添加偏远费补交信息" style="background:url('/admins/images/icons/blue_money.png');display:block;width: 16px; height: 16px;position: absolute;left: 310px; top: 190px;"></a>
                                    <input type='hidden' name="finance_transaction_params" value='<?php echo json_encode($pyffinanceParams); ?>' />
                                </form>
                            </td>
                        </tr>

                    </table>
                <?php } ?>
                <?php if ($this->billall->interior >= Application_Model_wayBillItem::Interior_System && $this->billall->interior != Application_Model_wayBillItem::Interior_PickError && $this->billall->interior != Application_Model_wayBillItem::Interior_OverSystem) { ?>
                    <div class="lcbox">
                        <table class="lcwc" >
                            <tr>
                                <td class="lcleft">
                                    <p class="yixz"><i></i>已入系统</p>
                                </td>
                                <td>
                                    <div class="qudao">
                                        <dl>
                                            <dt>结算重量：</dt>
                                            <dd><?php echo $this->billall->lastWeight / 1000; ?>kg</dd>
                                        </dl>
                                        <dl>
                                            <dt>结算体积：</dt>
                                            <dd>
                                                <?php
                                                if ($this->billall->lastVolumeWeight) {
                                                    echo ($this->billall->lastVolumeWeight != 0) ? ($this->billall->lastVolumeWeight / 1000) . "kg" : "";
                                                    echo $this->billall->lwhth != "**" ? ($this->billall->lwhth != "" ? "<em>-</em>[尺寸:" . $this->billall->lwhth . "cm]" : "无 " ) : "无";
                                                } else {
                                                    echo "无";
                                                }
                                                ?>
                                            </dd>
                                        </dl>
                                        <dl>
                                            <dt>结算金额：</dt>
                                            <dd>
                                                <ul>
                                                    <li class="num">￥<?php echo $this->billall->lastMoney; ?></li>
                                                    <li class="tk">[退款：￥<?php echo $this->billall->refundMoney; ?>]</li>
                                                </ul>
                                            </dd>
                                        </dl>
                                    </div>
                                </td>
                            </tr>
                        </table>
                    </div>
                <?php } ?>
                <?php if (($this->billall->interior == Application_Model_wayBillItem::Interior_System || $this->billall->interior == Application_Model_wayBillItem::Interior_Oversingleno) && ($this->billall->problem != Application_Model_wayBillItem::Problem_Appear && $this->billall->problem != Application_Model_wayBillItem::Problem_Cancel)) { ?>
                    <div class="lcbox">
                        <table class="lcks" >
                            <form method="post" action="/admini/managewaybill/affirmsingle/id/<?php echo $this->billall->id; ?>?_rf=<?= urlencode($this->referer) ?>" id="formsystem">
                                <tr>
                                    <td class="lcleft"><p>待出转单</p></td>
                                    <td>
                                        <div class="qudao">
                                            <dl>
                                                <dt>填写转单号：</dt>
                                                <dd>                                                    
                                                <?php if($this->billall->logistics == '' && in_array($this->billall->shipType, array(3,4,11,31,29,9,16,14,2,1,10))): ?>
                                                    <div class="textbox"><input class="textinput w250" type="text" id="logistics" name="logistics" value="<?php echo $this->billall->agentNo; ?>"/></div>
                                                <?php else: ?>
                                                	<div class="textbox"><input class="textinput w250" type="text" id="logistics" name="logistics" value="<?php echo $this->billall->logistics; ?>"/></div>
                                                <?php endif; ?>
                                                </dd>
                                            </dl>
                                            <div class="lctijiao">
                                                <input type="hidden" id="billid" name="billid" value="<?php echo $this->billall->id; ?>" />
                                                <a href="javascript:void(0)" class="anvbotton5" id="billsingle"><span>提交确认</span></a>
                                            </div>
                                        </div>
                                    </td>
                                </tr>
                            </form>
                        </table>
                    </div>
                <?php } ?>
                <?php if (($this->billall->interior >= Application_Model_wayBillItem::Interior_Singleno && $this->billall->interior < Application_Model_wayBillItem::Interior_PickError) || $this->billall->interior > Application_Model_wayBillItem::Interior_Oversingleno) { ?>
                    <div class="lcbox">
                        <table class="lcwc" >
                            <tr>
                                <td class="lcleft">
                                    <p class="yixz"><i></i>已出转单</p>
                                </td>
                                <td>
                                    <div class="qudao">
                                        <dl>
                                            <dt>转单号：</dt>
                                            <dd><?php echo $this->billall->logistics; ?></dd>
                                        </dl>
                                    </div>
                                </td>
                            </tr>
                        </table>
                    </div>
                <?php } ?>
                <?php if (($this->billall->interior == Application_Model_wayBillItem::Interior_Singleno || $this->billall->interior == Application_Model_wayBillItem::Interior_OutTransportation) && ($this->billall->problem != Application_Model_wayBillItem::Problem_Appear && $this->billall->problem != Application_Model_wayBillItem::Problem_Cancel)) { ?>
                    <div class="lcbox">
                        <table class="lcwc" >
                            <tr>
                                <td class="lcleft"><p>待确认上网</p></td>
                                <td>
                                    <div class="qudao">
                                        <p class="sming">请及时进入渠道商系统跟踪是否上网！</p>
                                        <div class="lctijiao">
                                            <a href="javascript:void(0)" class="anvbotton5" id="affirmshang"><span>确认已上网</span></a>
                                        </div>
                                    </div>
                                </td>
                            </tr>
                        </table>
                    </div>
                <?php } ?>
                <?php if (($this->billall->interior >= Application_Model_wayBillItem::Interior_Transportation && $this->billall->interior < Application_Model_wayBillItem::Interior_PickError) || $this->billall->interior > Application_Model_wayBillItem::Interior_OutTransportation) { ?>
                    <div class="lcbox">
                        <table class="lcwc" >
                            <tr>
                                <td class="lcleft">
                                    <p class="yixz"><i></i>已上网</p>
                                </td>
                                <td>
                                    <div class="qudao">
                                        <dl>
                                            <dt>是否上网：</dt>
                                            <dd>是</dd>
                                        </dl>
                                    </div>
                                </td>
                            </tr>
                        </table>
                    </div>
                <?php } ?>
                <?php if (($this->billall->interior == Application_Model_wayBillItem::Interior_Transportation || $this->billall->interior == Application_Model_wayBillItem::Interior_Overachieve) && ($this->billall->problem != Application_Model_wayBillItem::Problem_Appear && $this->billall->problem != Application_Model_wayBillItem::Problem_Cancel)) { ?>
                    <div class="lcbox">
                        <table class="lcwc" >
                            <tr>
                                <td class="lcleft"><p>待确认签收</p></td>
                                <td>
                                    <div class="qudao">
                                        <p class="sming">确保运单被客户签收，本次服务才算圆满！</p>
                                        <div class="lctijiao">
                                            <a href="javascript:void(0)" class="anvbotton5" id="affirmqian"><span>确认已签收</span></a>
                                        </div>
                                    </div>
                                </td>
                            </tr>
                        </table>
                    </div>
                <?php } ?>
                <?php if ($this->billall->interior == Application_Model_wayBillItem::Interior_Achieve) { ?>
                    <div class="lcbox">
                        <table class="lcwc" >
                            <tr>
                                <td class="lcleft">
                                    <p class="yixz"><i></i>已签收</p>
                                </td>
                                <td>
                                    <div class="qudao">
                                        <dl>
                                            <dt>是否签收：</dt>
                                            <dd>是</dd>
                                        </dl>
                                    </div>
                                </td>
                            </tr>
                        </table>
                    </div>
                <?php } ?>

            </div> 
        <?php } ?>
        <?php
        if ($this->problemWay) {
            if ($this->problemWay->status == Application_Model_ProblemWay::Problem_ReturnCancel) {
                ?>
                <div class="yunshu">
                    <div class="lanmu">
                        <h2>退货流程</h2>
                    </div>
                    <?php if ($this->billall->interior >= Application_Model_wayBillItem::Interior_Outstorage && $this->billall->interior != Application_Model_wayBillItem::Interior_PickError) { ?>
                        <?php if ($this->problemWay->schedule == Application_Model_ProblemWay::Schedule_Default) { ?>
                            <div class="lcbox">
                                <form method="post" action="/admini/manageproblem/scheduledefault/id/<?php echo $this->billall->id; ?>?_rf=<?= urlencode($this->referer) ?>" id="formdefault">
                                    <table class="lcks">
                                        <tr>
                                            <td class="lcleft"><p>待申请</p></td>
                                            <td>
                                                <div class="qudao">
                                                    <dl>
                                                        <dt>退包类型：</dt>
                                                        <dd>
                                                            <ul>
                                                                <li><label><input id="ScheduleType" name="ScheduleType" type="radio" value="渠道商退包" checked>渠道商退包</label></li>
                                                                <li><label><input id="ScheduleType" name="ScheduleType" type="radio" value="快递公司退包">快递公司退包</label></li>
                                                                <li><label><input id="ScheduleType" name="ScheduleType" type="radio" value="外国海关退包">外国海关退包</label></li>
                                                                <li><label><input id="ScheduleType" name="ScheduleType" type="radio" value="无人签收退包">无人签收退包</label></li>
                                                            </ul>
                                                        </dd>
                                                    </dl>
                                                    <div class="lctijiao">
                                                        <a href="javascript:$('#formdefault').submit()" class="anvbotton5"><span>确认已申请</span></a>
                                                    </div>
                                                </div>
                                            </td>
                                        </tr>
                                    </table>
                                </form>
                            </div>
                        <?php } ?>
                        <?php if ($this->problemWay->schedule >= Application_Model_ProblemWay::Schedule_ApplyFor) { ?>
                            <div class="lcbox">
                                <table class="lcwc">
                                    <tr>
                                        <td class="lcleft">
                                            <p class="yixz yixz2"><i></i>已申请</p>
                                        </td>
                                        <td>
                                            <div class="qudao">
                                                <dl>
                                                    <dt>退件类型：</dt>
                                                    <dd><?php echo $this->problemWay->ReasonBySchedule ? $this->problemWay->ReasonBySchedule->content : "悠奇仓库退件"; ?></dd>
                                                </dl>
                                            </div>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        <?php } ?>
                        <?php
                        if ($this->problemWay->ReasonBySchedule) {
                            if ($this->problemWay->ReasonBySchedule->content != "渠道商退包") {
                                ?>
                                <?php if ($this->problemWay->schedule == Application_Model_ProblemWay::Schedule_ApplyFor) { ?>
                                    <div class="lcbox">
                                        <table class="lcks">
                                            <tr>
                                                <td class="lcleft"><p>确认退件</p></td>
                                                <td>
                                                    <div class="qudao">
                                                        <p class="sming">请确认退件申请是否受理成功！</p>
                                                        <div class="lctijiao">
                                                            <a href="javascript:void(0)" class="anvbotton5" id="scheduleApplyFor"><span>已确认</span></a>
                                                        </div>
                                                    </div>
                                                </td>
                                            </tr>
                                        </table>
                                    </div>
                                <?php } ?>
                                <?php if ($this->problemWay->schedule >= Application_Model_ProblemWay::Schedule_ReturnRoute) { ?>
                                    <div class="lcbox">
                                        <table class="lcwc">
                                            <tr>
                                                <td class="lcleft">
                                                    <p class="yixz yixz2"><i></i>退件途中</p>
                                                </td>
                                                <td>
                                                    <div class="qudao">
                                                        <dl>
                                                            <dt>受理状态：</dt>
                                                            <dd>已受理，退件途中</dd>
                                                        </dl>
                                                    </div>
                                                </td>
                                            </tr>
                                        </table>
                                    </div>
                                <?php } ?>
                                <?php if ($this->problemWay->schedule == Application_Model_ProblemWay::Schedule_ReturnRoute) { ?>
                                    <div class="lcbox">
                                        <table class="lcks">
                                            <tr>
                                                <td class="lcleft"><p>待回渠道商</p></td>
                                                <td>
                                                    <div class="qudao">
                                                        <p class="sming">请及时跟进退件状态！</p>
                                                        <div class="lctijiao">
                                                            <a href="javascript:void(0)" class="anvbotton5" id='ScheduleReturnRoute'><span>已回渠道商</span></a>
                                                        </div>
                                                    </div>
                                                </td>
                                            </tr>
                                        </table>
                                    </div>
                                <?php } ?>
                                <?php
                            }
                        }
                        ?>
                        <?php if ($this->problemWay->schedule >= Application_Model_ProblemWay::Schedule_InChannel) { ?>
                            <div class="lcbox">
                                <table class="lcwc">
                                    <tr>
                                        <td class="lcleft">
                                            <p class="yixz yixz2"><i></i>已在渠道商</p>
                                        </td>
                                        <td>
                                            <div class="qudao">
                                                <dl>
                                                    <dt>回渠道确认：</dt>
                                                    <dd>已退至<?php echo $agentLog ? $agentLog->DescriptionByAgent->name : ($this->billall->agentcompname ? $this->billall->agentcompname->name : "悠奇仓库"); ?></dd>
                                                </dl>
                                            </div>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        <?php } ?>
                        <?php if ($this->problemWay->schedule == Application_Model_ProblemWay::Schedule_InChannel) { ?>
                            <div class="lcbox">
                                <table class="lcks">
                                    <tr>
                                        <td class="lcleft"><p>待退回悠奇</p></td>
                                        <td>
                                            <div class="qudao">
                                                <p class="sming">请确认退件是否已回悠奇！</p>
                                                <div class="lctijiao">
                                                    <a href="javascript:void(0)" class="anvbotton5" id='ScheduleInChannel'><span>确认已退回</span></a>
                                                </div>
                                            </div>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        <?php } ?>
                    <?php } ?>
                    <?php if ($this->problemWay->schedule >= Application_Model_ProblemWay::Schedule_InUuch) { ?>
                        <div class="lcbox">
                            <table class="lcwc">
                                <tr>
                                    <td class="lcleft">
                                        <p class="yixz yixz2"><i></i>已退回悠奇</p>
                                    </td>
                                    <td>
                                        <div class="qudao">
                                            <dl>
                                                <dt>是否已退回：</dt>
                                                <dd>是</dd>
                                            </dl>
                                        </div>
                                    </td>
                                </tr>
                            </table>
                        </div>
                    <?php } ?>
                    <?php if ($this->problemWay->schedule == Application_Model_ProblemWay::Schedule_InUuch) { ?>
                        <div class="lcbox">
                            <table class="lcks">
                                <tr>
                                    <td class="lcleft"><p>待入仓</p></td>
                                    <td>
                                        <div class="qudao">
                                            <p class="sming">请将退件物品进行入仓处理！</p>
                                            <div class="lctijiao">
                                                <a href="javascript:void(0)" class="anvbotton5" id='ScheduleInUuch'><span>确认已入仓</span></a>
                                            </div>
                                        </div>
                                    </td>
                                </tr>
                            </table>
                        </div>
                    <?php } ?>
                    <?php if ($this->problemWay->schedule == Application_Model_ProblemWay::Schedule_InStore) { ?>
                        <div class="lcbox">
                            <table class="lcwc">
                                <tr>
                                    <td class="lcleft">
                                        <p class="yixz yixz2"><i></i>已入仓</p>
                                    </td>
                                    <td>
                                        <div class="qudao">
                                            <dl>
                                                <dt>是否已入仓：</dt>
                                                <dd>是</dd>
                                            </dl>
                                        </div>
                                    </td>
                                </tr>
                            </table>
                        </div>
                    <?php } ?>
                </div>
                <?php
            }
            if ($this->problemWay->status == Application_Model_ProblemWay::Problem_PartReturn) {
                ?>
                <div class="yunshu">
                    <div class="lanmu">
                        <h2>部分物品退回流程</h2>
                    </div>
                    <?php if ($this->billall->interior >= Application_Model_wayBillItem::Interior_Outstorage && $this->billall->interior != Application_Model_wayBillItem::Interior_PickError) { ?>
                        <?php if ($this->problemWay->schedule == Application_Model_ProblemWay::Schedule_Default) { ?>
                            <div class="lcbox">
                                <table class="lcks">
                                    <tr>
                                        <td class="lcleft"><p>待申请</p></td>
                                        <td>
                                            <div class="qudao">
                                                <p class="sming">为确保包裹正常运送，请向渠道商申请退回部分物品！</p>
                                                <div class="lctijiao">
                                                    <a href="javascript:void(0)" class="anvbotton5" id='PartDefault'><span>确认已申请</span></a>
                                                </div>
                                            </div>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        <?php } ?>
                        <?php if ($this->problemWay->schedule >= Application_Model_ProblemWay::Schedule_ApplyFor) { ?>
                            <div class="lcbox">
                                <table class="lcwc">
                                    <tr>
                                        <td class="lcleft">
                                            <p class="yixz yixz2"><i></i>已申请</p>
                                        </td>
                                        <td>
                                            <div class="qudao">
                                                <dl>
                                                    <dt>是否已申请：</dt>
                                                    <dd>是</dd>
                                                </dl>
                                            </div>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        <?php } ?>
                        <?php if ($this->problemWay->schedule == Application_Model_ProblemWay::Schedule_ApplyFor) { ?>
                            <div class="lcbox">
                                <table class="lcks">
                                    <tr>
                                        <td class="lcleft"><p>确认退回</p></td>
                                        <td>
                                            <div class="qudao">
                                                <p class="sming">请确认退件申请是否受理成功！</p>
                                                <div class="lctijiao">
                                                    <a href="javascript:void(0)" class="anvbotton5" id='PartApplyFor'><span>已确认</span></a>
                                                </div>
                                            </div>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        <?php } ?>
                        <?php if ($this->problemWay->schedule >= Application_Model_ProblemWay::Schedule_ReturnRoute) { ?>
                            <div class="lcbox">
                                <table class="lcwc">
                                    <tr>
                                        <td class="lcleft">
                                            <p class="yixz yixz2"><i></i>退回途中</p>
                                        </td>
                                        <td>
                                            <div class="qudao">
                                                <dl>
                                                    <dt>受理状态：</dt>
                                                    <dd>已受理，退回途中</dd>
                                                </dl>
                                            </div>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        <?php } ?>
                        <?php if ($this->problemWay->schedule == Application_Model_ProblemWay::Schedule_ReturnRoute) { ?>
                            <div class="lcbox">
                                <table class="lcks">
                                    <tr>
                                        <td class="lcleft"><p>待退回悠奇</p></td>
                                        <td>
                                            <div class="qudao">
                                                <p class="sming">请确认物品是否已退回悠奇！</p>
                                                <div class="lctijiao">
                                                    <a href="javascript:void(0)" class="anvbotton5" id='PartReturnRoute'><span>确认已退回</span></a>
                                                </div>
                                            </div>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        <?php } ?>
                    <?php } ?>
                    <?php if ($this->problemWay->schedule >= Application_Model_ProblemWay::Schedule_InUuch) { ?>
                        <div class="lcbox">
                            <table class="lcwc">
                                <tr>
                                    <td class="lcleft">
                                        <p class="yixz yixz2"><i></i>已退回悠奇</p>
                                    </td>
                                    <td>
                                        <div class="qudao">
                                            <dl>
                                                <dt>是否已退回：</dt>
                                                <dd>是</dd>
                                            </dl>
                                        </div>
                                    </td>
                                </tr>
                            </table>
                        </div>
                    <?php } ?>
                    <?php if ($this->problemWay->schedule == Application_Model_ProblemWay::Schedule_InUuch) { ?>
                        <div class="lcbox">
                            <table class="lcks">
                                <tr>
                                    <td class="lcleft"><p>待入仓</p></td>
                                    <td>
                                        <div class="qudao">
                                            <p class="sming">请将退回的物品进行入仓处理！</p>
                                            <div class="lctijiao">
                                                <a href="javascript:void(0)" class="anvbotton5" id='PartInUuch'><span>确认已入仓</span></a>
                                            </div>
                                        </div>
                                    </td>
                                </tr>
                            </table>
                        </div>
                    <?php } ?>
                    <?php if ($this->problemWay->schedule == Application_Model_ProblemWay::Schedule_InStore) { ?>
                        <div class="lcbox">
                            <table class="lcwc">
                                <tr>
                                    <td class="lcleft">
                                        <p class="yixz yixz2"><i></i>已入仓</p>
                                    </td>
                                    <td>
                                        <div class="qudao">
                                            <dl>
                                                <dt>是否已入仓：</dt>
                                                <dd>是</dd>
                                            </dl>
                                        </div>
                                    </td>
                                </tr>
                            </table>
                        </div>
                    <?php } ?>
                </div>
                <?php
            }
        }
        ?>
        <?php if ($this->billall->interior >= Application_Model_wayBillItem::Interior_Outstorage && $this->billall->interior != Application_Model_wayBillItem::Interior_PickError) { ?>
            <div class="genzongbox">
                <div class="lanmu">
                    <h2>物流跟踪</h2>
                </div>
                <div class="genzong">
                    <div class="genzongtop">
                        <div class="genzinly">
                            <ul>
                                <li>信息来源：<a href="<?php echo $this->billall->getExpressChannelBy() ? $this->billall->getExpressChannelBy()->WebUrl : ''; ?>"><?php echo $this->billall->getExpressChannelBy() ? $this->billall->getExpressChannelBy()->Name : ''; ?>官网</a></li>
                                <li>悠奇运单号：<?php echo $this->billall->billNo; ?></li>
                                <?php if ($this->billall->interior >= Application_Model_wayBillItem::Interior_Singleno && $this->billall->interior != Application_Model_wayBillItem::Interior_PickError) { ?>
                                    <li><?php echo $this->billall->getChannelBy()->Name; ?>改单号：<?php echo $this->billall->logistics; ?></li>
                                <?php } ?>
                            </ul>
                        </div>
                        <div class="tjjilu">
                            <label>操作时间：</label><input class="textinput w140" type="text" value="<?php echo date('Y-m-d H:i:s'); ?>" id="opdate" name="opdate"  />
                            <label>内容：</label><input class="textinput w400" type="text" id="opremark" name="opremark"/><a class="anvbotton5" href="javascript:void(0)" id="addlog"><span>确认</span></a>
                        </div>
                    </div>
                    <div class="genzonginfo">
                        <table>
                            <?php foreach ($this->liclog as $key => $kval) {
                                ?>
                                <tr <?php echo $key == 0 ? 'class="red"' : ""; ?> id="liclog<?php echo $kval->id; ?>">
                                    <td class="gz"><?php echo date("Y-m-d H:i", strtotime($kval->opDate)); ?></td>
                                    <td><?php echo $kval->opRemark; ?></td>
                                    <td class="gzsc"><a href="javascript:void(0)" id="dellog" name="<?php echo $kval->id; ?>">删除</a></td>
                                </tr>
                            <?php } ?>
                        </table>
                        <?php
                        if ($this->billall->Logistics != null && $this->billall->Logistics != '') {
                            ?>
                            <table>
                                <tr>
                                    <td>
                                        <div id="shipInfo">
                                            物流状态加载中,请稍候... 
                                        </div>
                                        <script type="text/javascript">
                                            $(function() {
                                                $.post('/admini/managewaybill/getexpress', {'id':<?= $this->billall->Id ?>, 'type': '2'}, function(data) {
                                                    if (data.isUrl != "0") {
                                                        var html = '<iframe name="kuaidi100" src="' + data.content + '" width="600" height="380" marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="0" scrolling="no"></iframe>';
                                                        $('#shipInfo').html(html);
                                                    } else {
                                                        $('#shipInfo').html(data.content);
                                                        if (data.type === 1) {
                                                            $('#shipInfo').html($('#shipInfo').html() + "<span style='margin-left:120px;'><font style='color:red'>该运单的物流信息，最近已经被" + data.operator + "于" + data.seeDate + "看过！</font></span><button id='haveToSee' style='margin-left:10px;width:50px;height:30px;'>已查看</button>");
                                                        } else {
                                                            $('#shipInfo').html($('#shipInfo').html() + "<button id='haveToSee' style='margin-left:128px;width:50px;height:30px;'>已查看</button>");
                                                        }
                                                    }
                                                }, 'json');
                                            });
                                        </script>
                                    </td>
                                </tr>
                            </table>
                        <?php } ?> 
                    </div>                    
                </div>
            </div> 
        <?php } ?>   
        <div class="qingdan">
            <div class="lanmu">
                <h2>物品清单</h2><?php $arrlocation = @explode(",", $this->billall->locationName); ?>
                <p><label>所占库位：</label>
                    <?php
                    foreach ($arrlocation as $key => $valname) {
                        if ($valname != "") {
                            echo $valname;
                            if ($key < count($arrlocation) - 2) {
                                echo "<span>|</span>";
                            }
                        }
                    }
                    ?>
                </p>
            </div>
            <div class="wupintable">
                <div class="biaotbody">
                    <table>
                        <tr>
                            <th class="li8"><div class="lileft">物品编号</div></th>
                        <th class="li35"><div class="lileft">物品信息</div></th>
                        <th class="li9"><div class="lileft">快递公司</div></th>
                        <th class="li9"><div class="lileft">快递号</div></th>
                        <th class="li7"><div class="lileft">来源</div></th>
                        <th class="li8"><div class="lileft">物品净重(kg)</div></th>
                        <th class="li8"><div class="lileft">预估体积(kg)</div></th>
                        <th class="li8"><div class="lileft">所在库位</div></th>
                        <th class="li8"><div class="lileft">拣货状态</div></th>
                        </tr>
                    </table>
                </div>
                <div class="table">
                    <table>
                        <?php
                        if ($this->storedetail != '') {
                            foreach ($this->storedetail as $storeItem) {
                                $Item = $storeItem->StoreIdByItem;
                                ?>
                                <tr>
                                    <td class="li8">
                                        <div class="lileft bianhao">
                                            <p><a href="/admini/managestore/storedetail/id/<?php echo $Item->id; ?>"  target="_blank"><?php echo $Item->barcode; ?></a></p>
                                            <span><?php echo $Item->createdate; ?></span>
                                        </div>
                                    </td>
                                    <td class="li35">
                                        <div class="lileft wpinfo">
                                            <div class="spic">
                                                <a href="<?= $this->cdn ?><?= !is_int(strpos('big', $Item->imageFile)) ? ('/big' . $Item->imageFile) : ($Item->imageFile) ?>"  target="_blank">
                                                    <img src="<?php echo $this->cdn; ?><?php echo $Item->image; ?>" /></a>
                                            </div>
                                            <div class="wpinfobox">
                                                <h2><a href="/admini/managestore/storedetail/id/<?php echo $Item->id; ?>"  target="_blank"><?php echo $Item->productName; ?></a></h2>
                                                <p>属性：<?php echo $Item->ItemTypeName; ?></p>
                                            </div>
                                        </div>
                                    </td>
                                    <td class="li9">
                                        <div class="lileft"><?php echo $Item->logisticsName; ?></div>
                                    </td>                                
                                    <td class="li9">
                                        <div class="lileft"><?php echo $Item->logistics; ?></div>
                                    </td>   
                                    <td class="li7">
                                        <div class="lileft"><?php echo $Item->intype; ?></div>
                                    </td>                             
                                    <td class="li8">
                                        <div class="lileft"><?php echo $Item->weight / 1000; ?></div>
                                    </td>                             
                                    <td class="li8">
                                        <div class="lileft"><?php echo $Item->volumeWeight / 1000; ?></div>
                                    </td>                             
                                    <td class="li8">
                                        <div class="lileft"><?php echo $Item->locationNo ? $Item->locationNo : "无"; ?></div>
                                    </td>                             
                                    <td class="li8">
                                        <div class="lileft"><?php echo $Item->InteriorName . "(内部)<br><span style='color:#c0c'>$Item->StatusName(前台)</span>"; ?></div>
                                    </td>                             
                                </tr>
                                <?php
                            }
                        }
                        ?>
                    </table>
                </div>    
            </div>
        </div>
    </div>     
</div>
<div class="tanchuang isProblemContent" style="display:none;">
    <div class="nui-msgbox">
        <div class="nui-msgbox-hd" id="wayProblem">问题包裹</div>
        <div class="nui-msgbox-hd" id="uuchInterior" style="display:none;">悠奇内部备注</div>
        <div class="nui-msgbox-hd" id="shangyibag" style="display:none;">包裹属性</div>
        <a class="nui-msgbox-close" title="关闭"><b></b></a>
    </div>
    <div class="wt_top">
        <div class="wt_nav">
            <ul>
                <li class="wt_on"><a href="javascript:void(0)" id="problem">问题沟通</a></li>
                <li ><a href="javascript:void(0)" id="dispose">处理与进度</a></li>
            </ul>
        </div>
    </div>
    <div class="wenti_box" id="problemComm">
        <div class="wt_center" style="height:300px;">
            <?php
            if ($this->issuedetail) {
                foreach ($this->issuedetail as $problemVal) {
                    ?>
                    <div class="<?php echo $problemVal->issuetype == 1 ? "wt_uuch" : "wt_kehu"; ?>">
                        <h2><?php echo $problemVal->issuetype == 1 ? "悠奇客服" : '回复人：<a href="/admini/manageuser/userdetail/id/' . $this->billall->userId . '" target="_blank">' . $this->billall->user->nikename . '</a>'; ?>
                            <span><?php echo $problemVal->dateCreated; ?></span></h2>
                        <p><?php echo htmlspecialchars($problemVal->content); ?></p>
                    </div>
                    <?php
                }
            }
            ?>
        </div>
        <form method="post" action="/admini/managewaybill1/affirmproblem/id/<?php echo $this->billall->id; ?>?_rf=<?= urlencode($this->referer) ?>" id="formproblem">
            <div style="margin-left:20px;margin-top: -5px;margin-bottom: 5px;">
                留言类型：<input type="radio" id="isProblem0" name="isProblem" value="0" <?php echo count($this->issuedetail) > 0 ? "checked" : ""; ?>>旧问题补充&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <input type="radio" id="isProblem1" name="isProblem" value="1" <?php echo count($this->issuedetail) > 0 ? "" : "checked"; ?>>新问题                
                <span style="float:right; margin-right:30px;"><input type="checkbox" name="repay" value="1" onClick="repayHandle(this)" />补交金额:<input type="text" value="" style="width:50px" id="repay-sum" data-id="<?php echo $this->billall->id ?>" readonly name="repaysum" /></span>
            </div>            
            <div class="wt_caozuo">
                <textarea name="content" cols="" rows="" id="content"></textarea><a class="wt_liuyan" href="javascript:$('#formproblem').submit();"><span>留言</span></a>
            </div>
        </form>
    </div>
    <div class="wenti_box" id="interiorRemark" style="display:none;padding-top: 20px;">

        <form method="post" action="/admini/managewaybill/addinteriorremark/id/<?php echo $this->billall->id; ?>?_rf=<?= urlencode($this->referer) ?>" id="formremark">
            <div class="wt_caozuo">
                <textarea name="interiorcontent" cols="" rows="" id="interiorcontent"></textarea><a class="wt_liuyan" href="javascript:$('#formremark').submit();"><span>留言</span></a>
            </div>
        </form>
    </div>
    <div class="wenti_box" id="addsyProperty" style="display:none;padding-top: 20px;">
        <div class="wt_caozuo">
            <textarea name="syproperty" cols="" rows="" id="syproperty"><?php echo $shangyiLog ? $shangyiLog->description : ""; ?></textarea><a class="wt_liuyan" href="javascript:addSyProperty();"><span>添加</span></a>
        </div>
    </div>
    <div class="wenti_box2"  style="display:none;">
        <form method="post" action="/admini/managewaybill/affirmschedule/id/<?php echo $this->billall->id; ?>?_rf=<?= urlencode($this->referer) ?>" id="formschedule">
            <div class="wttj">
                <input class="textinput w140" type="text" value="<?php echo date("Y-m-d H:i:s"); ?>" id='crdate' name='crdate'/>
                <input class="textinput w300" type="text" id='schedule' name='schedule' /><a class="anvbotton5" href="javascript:void(0)" id='affirmjindu'><span>确认</span></a>
            </div>
        </form>
        <div class="wenti_jindu">
            <table>
                <?php
                if ($this->scheduledetail) {
                    foreach ($this->scheduledetail as $key => $operateVal) {
                        ?>
                        <tr <?php echo $key == 0 ? 'class="jd_on"' : ""; ?>>
                            <td class="wtjd_z"><p><?php echo $operateVal->dateCreated; ?><i></i></p></td>
                            <td><?php echo $operateVal->content; ?></td>
                        </tr>
                        <?php
                    }
                }
                ?>
            </table>
        </div>
        <div class="wenticaoz">
            <?php
            if ($this->problemWay && @$this->problemWay->status != "") {
                if ($this->problemWay->status != Application_Model_ProblemWay::Problem_StayUser && $this->problemWay->status != Application_Model_ProblemWay::Problem_StayUuch) {
                    ?>
                    <p>该问题运单已选择<?php echo $this->problemWay->StatusName; ?>！<a href="javascript:void(0)" id='CancelReturn'>取消</a></p>
                <?php } else { ?>
                    <ul>
                        <li><a class="anvbotton6" id='ReturnCancel'><span>退件</span></a></li>
                        <li><a class="anvbotton6" id='PartReturn'><span>部分退回</span></a></li>
                        <li><a class="anvbotton6" id='achieveProblem'><span>设为正常</span></a></li>
                    </ul>
                    <?php
                }
            }
            ?>
        </div>
    </div>
</div>
<div class="tanchuang"  id="zzfwfinance" style="width: 760px; display: none; overflow: hidden">
    <div class="nui-msgbox">
        <div class="nui-msgbox-hd">手工入账</div>
        <a class="nui-msgbox-close" title="关闭"><b></b></a>
    </div>
    <div class="wt_top">
        <div class="wt_nav">
            <ul>
                <li class="wt_on" style="display: list-item;"><a href="javascript:void(0)" id="handworkTitle">手工入账</a></li>

            </ul>
        </div>
    </div>
    <div class="wenti_box" style="">
        <div class="wt_center table" style="width:700px;height: 400px;">
            <table>
                <tbody>
                    <tr>
                        <td style="width: 180px;text-align: right;padding-right: 20px;">悠奇运单编号：</td>
                        <td style="width: 420px;" class="w0"><input type="hidden" name="order_sn" value="<?php echo $this->billall->billNo ?>" /><?php echo $this->billall->billNo; ?></td>
                    </tr>
                    <tr>
                        <td style="width: 180px;text-align: right;padding-right: 20px;">类型：</td>
                        <td style="width: 420px;" class="w0">
                            <select name="zzfwtype">
                                <option value="add">增加</option>
                                <option value="del">减少</option>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td style="width: 180px;text-align: right;padding-right: 20px;">增值服务：</td>
                        <td style="width: 420px;" class="w0 vaservice"></td>
                    </tr>
                    <tr>

                        <td style="width: 180px;text-align: right;padding-right: 20px;">金额：</td>
                        <td style="width: 420px;" class="w0"><input type="text" name="amount" value=""></td>
                    </tr>
                    <tr>
                        <td colspan="4">
                            <div class="lctijiao" style="width: 100px;float: left;margin-left: 200px;">
                                <a class="anvbotton5" href="javascript:void(0)"><span>确认</span></a>
                            </div>
                            <div style="width: 50px;float: left;padding-top: 12px;">
                                <a href="javascript:void(0)" class="nui-btn-text retanchuang">取消</a>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="4">
                            <div class="checkHistory" style="width: 93%;float: left;margin-left: 50px;">

                            </div>
                        </td>
                    </tr>
                </tbody></table>
        </div>
    </div>
</div>
<div class="houtai_overlay" style="display:none;"></div>
<div class="tanchuang finance-work" style="width: 760px; display: none;">
    <div class="nui-msgbox">
        <div class="nui-msgbox-hd">手工入账</div>
        <a class="nui-msgbox-close" title="关闭"><b></b></a>
    </div>
    <div class="wt_top">
        <div class="wt_nav">
            <ul>
                <li class="wt_on" style="display: list-item;"><a href="javascript:void(0)" id="handworkTitle">手工入账</a></li>

            </ul>
        </div>
    </div>
    <div class="wenti_box" id="handworkConent" style="">
        <div class="wt_center table" style="width:700px;height: 450px;">
            <table>
                <tbody>
                    <tr>
                        <td style="width: 180px;text-align: right;padding-right: 20px;">悠奇运单编号：</td>
                        <td style="width: 420px;" class="w0"><input type="hidden" name="order_sn" value="<?php echo $this->billall->billNo ?>" /><?php echo $this->billall->billNo; ?></td>
                    </tr>
                    <tr>
                        <td style="width: 180px;text-align: right;padding-right: 20px;">原渠道商：</td>
                        <td style="width: 420px;" class="w0"><input type="text" name="or_channel_company" value="<?php echo $this->billall->agentcompname ? $this->billall->agentcompname->name : ""; ?>"></td>
                    </tr>
                    <tr>
                        <td style="width: 180px;text-align: right;padding-right: 20px;">原渠道：</td>
                        <td style="width: 420px;" class="w0"><input type="text" name="orgin_channel" value="<?php echo $this->billall->ExpressBy->name; ?>"></td>
                    </tr>
                    <tr>
                        <td style="width: 180px;text-align: right;padding-right: 20px;">原运费：</td>
                        <td style="width: 420px;" class="w0"><input type="text" name="orgin_ship_fee" value="<?php echo $this->billall->getFeeByType(Application_Model_FeeType::EstimateShipFee); ?>"></td>
                    </tr>
                    <tr>
                        <td style="width: 180px;text-align: right;padding-right: 20px;">重量：</td>
                        <td style="width: 420px;" class="w0"><input type="text" name="weight" value="<?php echo $bagTotalWeight; ?>"></td>
                    </tr>
                    <tr>
                        <td style="width: 180px;text-align: right;padding-right: 20px;">体积：</td>
                        <td style="width: 420px;" class="w0"><input type="text" name="volume" value="<?php echo $bagVolumeWeight; ?>"></td>
                    </tr>
                    <tr>

                        <td style="width: 180px;text-align: right;padding-right: 20px;">新渠道商：</td>
                        <td style="width: 420px;" class="w0"><input type="text" name="new_channel_company" value="<?php echo $agentLog->DescriptionByAgent->name; ?>"></td>
                    </tr>

                    <tr>

                        <td style="width: 180px;text-align: right;padding-right: 20px;">新渠道：</td>
                        <td style="width: 420px;" class="w0"><input type="text" name="new_channel" value="<?php echo $channelLog->DescriptionByChannel->name; ?>"></td>
                    </tr>
                    <tr>
                        <td style="width: 180px;text-align: right;padding-right: 20px;">新运费：</td>
                        <td style="width: 420px;" class="w0"><input type="text" name="new_ship_fee" value=""></td>
                    </tr>
                    <tr>
                        <td style="width: 180px;text-align: right;padding-right: 20px;">补交款：</td>
                        <td style="width: 420px;" class="w0"><input type="text" name="amount" value=""></td>
                    </tr>
                    <tr>
                        <td colspan="4">
                            <div class="lctijiao" style="width: 100px;float: left;margin-left: 200px;">
                                <a class="anvbotton5" href="javascript:void(0)" id="subFinance"><span>确认</span></a>
                            </div>
                            <div style="width: 50px;float: left;padding-top: 12px;">
                                <a href="javascript:void(0)" class="nui-btn-text retanchuang" id="finance-cancel">取消</a>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="4">
                            <div class="checkHistory" style="width: 93%;float: left;margin-left: 50px;">

                            </div>
                        </td>
                    </tr>
                </tbody></table>
        </div>
    </div>
</div>
</div>
<?php if ($this->billall->interior != Application_Model_wayBillItem::Interior_Launch) { ?>
    <script type="text/javascript">
        $(".jinerjt").live("mouseenter", function() {
            $(this).next("div").attr("style", "");
        });
        $(".jinerxial").mouseleave(function() {
            $(".jinerxial .jinerxiang").attr("style", "display:none;");
        });
        $("#editInterior").click(function() {
            $("#editupdete").attr("class", "nui-btn nuion");
            $(this).next("div").attr("style", "");
        });
        $("#editStatus").click(function() {
            $("#updeteedit").attr("class", "nui-btn nuion");
            $(this).next("div").attr("style", "");
        });
        $("#updeteedit").mouseleave(function() {
            $("#updeteedit").attr("class", "nui-btn");
            $("#updeteedit .ztlist").attr("style", "display:none;");
        });
        $("#editupdete").mouseleave(function() {
            $("#editupdete").attr("class", "nui-btn");
            $("#editupdete .ztlist").attr("style", "display:none;");
        });
        $(".dian").mouseenter(function() {
            $(this).next("div").attr("style", "display:block;");
        });
        $(".bzloading").mouseleave(function() {
            $(".bzloading .bzxiangbox").attr("style", "display:none;");
        });
        $("#cancel").live('click', function() {
            if (<?php echo $this->billall->problem ? $this->billall->problem : 0; ?> == 1) {
                if (<?php echo $this->billall->interior > Application_Model_wayBillItem::Interior_Picking ? 1 : 0; ?>) {
                    alert("不能直接取消已经打包的运单，可以走问题运单处理的退件！");
                    return false;
                } else {
                    if (confirm("您确定取消该运单？", "提示信息")) {
                        $.ajax({
                            type: 'POST',
                            url: '/admini/managewaybill/cancel/id/<?php echo $this->billall->id; ?>',
                            success: function(data) {
                                if (data == 2) {
                                    alert("运单取消成功！");
                                } else if (data == 22) {
                                    alert("只能撤销未受理和问题的运单");
                                } else {
                                    alert("发生未知错误，请重新操作");
                                }
                                // location.reload();
                            }
                        });
                    }
                }
            } else {
                alert("只能取消问题运单！");
                return false;
            }
        });
    <?php if ($this->billall->interior == Application_Model_wayBillItem::Interior_Processing) { ?>
            $('#hear').live("click", function() {
                var pv = parseFloat($('#premiumFee').text());
                var isContinue = true;
                if (!isNaN(pv) && pv >= 5000) {
                    isContinue = confirm('请注意,投保价值大于5000元,请上报主管!是否继续受理');
                }
                if (!isContinue) {
                    return false;
                }
                $.ajax({
                    type: 'POST',
                    url: '/admini/managewaybill/billhear/idlist/<?php echo $this->billall->id; ?>/payWeight/<?php echo $payWeight; ?>',
                    success: function(data) {
                        if (data == 1) {
                            alert("受理成功");
                        } else if (data == 0) {
                            alert("运单的前台状态不是未受理！");
                        } else {
                            alert("发生未知错误，请重新操作");
                        }
                        location.reload();
                    }
                });
                return false;
            });
    <?php } ?>
    <?php if ($this->billall->interior == Application_Model_wayBillItem::Interior_Confrimed || $this->billall->interior == Application_Model_wayBillItem::Interior_Pick) { ?>
            var EubIdArr = new Array("37", "38", "52", "54", "82", "89", "90", "110", "120", "121", "125", "206", "211", "213", "216", "288", "289", "290", "291", "294", "295", "322", "323");
            $("#radioChannel").click(function() {
                fillChannel($('.agentid:checked').val());
            });
            $("#editshiptype").live("change", function() {
                var id = $(this).val();
                $("#agentChannelCostPrice").html('<tr><td>正在获取报价,请稍候</td></tr>');
                $.post('/admini/managewaybill/trans', {'id': id, 'word': "<?php echo $this->billall->state; ?>", 'rweight': "<?php echo $payWeight; ?>"}, function(sj) {
                    var html = "";
                    html = '<tr><th class="jg0">选择</th><th class="jg1">代理商</th><th class="jg2">发货渠道</th><th class="jg3">报价(元)</th></tr>';
                    if (sj.data) {
                        $.each(sj.data, function(key, val) {
                            html += '<tr><td><input type="radio" class="channel" value="' + val.id + '" name="channel" /></td><td>' + val.agentName + '</td><td>' + val.channelName + '</td><td>' + val.price + '</td></tr>';
                        });
                    }
                    $("#agentChannelCostPrice").html(html);
                }, 'json');
            });
            $("#formshipchanner .agentid").change(function() {
                var agentId = $(this).val();
                if (agentId == <?php echo Application_Model_AgentCompany::Agent_4px; ?>) {
                    $("#formshipchanner #ship4px").show();
                } else {
                    $("#formshipchanner #ship4px").hide();
                }
            });
            $("#formshipchanner #channer").change(function() {
                var channer = $(this).val();
                if ($.inArray(channer, EubIdArr) >= 0) {
                    $("#formshipchanner .eubAddress").show();
                    $("#formshipchanner #shipEub").show();
                } else {
                    $("#formshipchanner .eubAddress").hide();
                    $("#formshipchanner #shipEub").hide();
                }
            });
            $("#ship4px").click(function() {
                var channer = $("#channer").val();
                if (channer == "") {
                    alert("请选择发货渠道");
                    return false;
                }
                $.post('/admini/managewaybill/ship4px', {'id':<?php echo $this->billall->id; ?>, 'channer': channer}, function(sj) {
                    if (sj.type == 1) {
                        alert("上传成功，可以确认渠道了");
                        $("#agentNo").val(sj.agentNo);
                    } else if (sj.type == 2) {
                        alert("请先做好发票在上传");
                    } else {
                        var message = "出现未知错误";
                        if (sj.message != "") {
                            message = sj.message;
                        }
                        alert(message);
                    }
                }, 'json');
            });
            $("#shipEub").click(function() {
                var city = $("#city").val();
                var province = $("#province").val();
                if (city == "") {
                    alert("收件人城市不能为空");
                    return false;
                }
                if (province == "") {
                    alert("收件人州不能为空");
                    return false;
                }
                $.post('/admini/managewaybill/shipeub', {'id':<?php echo $this->billall->id; ?>, 'province': province, 'city': city}, function(sj) {
                    if (sj.type == 1) {
                        alert("上传成功，可以确认渠道了");
        //                        window.location = "http://admin1.uuch.com/admini/job/eubpdf?id=<?php // echo $this->billall->id;  ?>";
                    } else {
                        alert("出现未知错误");
                    }
                }, 'json');
            });
            var channel = <?= json_encode($this->channel); ?>;
            function findChannel(agentId, expressId) {
                var result = [];
                $.each(channel, function(index, item) {
                    if (item.agentId == agentId && (expressId == null || item.expressId == expressId && agentId != 7)) {
                        result.push(item);
                    }
                    if (agentId == 7) {
                        result.push(item);
                    }
                });
                return result;
            }
            function convertSelect(channel) {
                var html = '';
                $.each(channel, function(index, item) {
                    html += '<option value="' + item.id + '">' + item.name + '</option>';
                });
                return html;
            }
            function fillChannel(agentId) {
                var channels = findChannel(agentId, $('#radioChannel').is(':checked') ? null : $('#expressId').val());
                var html = convertSelect(channels);
                $('#channer').html(html);
            }
            $(function() {
                $('.agentid').click(function() {
                    fillChannel($(this).val());
                    var channer = $("#formshipchanner #channer").val();
                    if ($.inArray(channer, EubIdArr) >= 0) {
                        $("#formshipchanner .eubAddress").show();
                        $("#formshipchanner #shipEub").show();
                    } else {
                        $("#formshipchanner .eubAddress").hide();
                        $("#formshipchanner #shipEub").hide();
                    }
                });
                //初始化时加载各代理商与渠道,价格信息
                $('.agentid').eq(0).click();
                $('#editshiptype').change();
            });
    <?php } ?>
    <?php if ($this->billall->interior == Application_Model_wayBillItem::Interior_Incoice || $this->billall->interior == Application_Model_wayBillItem::Interior_PickError) { ?>
            $('#pick').click(function() {
                $.ajax({
                    type: 'POST',
                    url: '/admini/managewaybill/affirmpick/id/<?php echo $this->billall->id; ?>',
                    success: function(data) {
                        if (data == 1) {
                            alert("设置成功！");
                        } else {
                            alert("请检查前后台运单状态");
                        }
                        location.reload();
                    }
                });
            });
            function affirmPicking(id)
            {
                if (confirm("您确定该商品已经找到吗？", "提示信息")) {
                    $.ajax({
                        type: 'POST',
                        url: '/admini/managewaybill/affirmfind/id/<?php echo $this->billall->id; ?>/storeid/' + id,
                        success: function(data) {
                            if (data == 1) {
                                alert("成功找到！");
                            } else if (data == 2) {
                                alert("请检查运单是否存在");
                            } else if (data == 3) {
                                alert("请检查丢失商品是否找到");
                            } else {
                                alert("发生未知错误，请重新操作");
                            }
                            location.reload();
                        }
                    });
                }
            }
    <?php } ?>
    <?php if ($this->billall->interior == Application_Model_wayBillItem::Interior_Picking) { ?>
            var way_num = 1;
            $('.forecastinput').live("change", function() {
                var i = $(this).attr("i");
                var length = $('#forecastlength_' + i).val();
                var width = $('#forecastwidth_' + i).val();
                var height = $('#forecastheight_' + i).val();
                var vloume = length * width * height / 5000;
                if (vloume > 0) {
                    var html = "[体积重量为 = " + vloume + "kg]";
                    $(".bag_" + i + " .tjzl_" + i).html(html);
                    $('#forecastvolumeWeight_' + i).attr('value', vloume);
                } else {
                    $(".bag_" + i + " .tjzl_" + i).html("");
                    $('#forecastvolumeWeight_' + i).attr('value', "0");
                }
                var waynum = $("#waynum").val();
                var totalWeight = 0;
                var totalVolume = 0;
                for (var i = 1; i <= waynum; i++) {
                    var weight = $("#forecastWeight_" + i).val();
                    if (typeof (weight) == 'NaN' || weight == "" || weight == "undefined" || weight == 0) {
                        weight = 0;
                    }
                    var volume = $("#forecastvolumeWeight_" + i).val();
                    if (typeof (volume) == 'NaN' || volume == "" || volume == "undefined") {
                        volume = 0;
                    }
                    totalWeight = RoundNumber(Number(totalWeight) + Number(weight), 4);
                    totalVolume = RoundNumber(Number(totalVolume) + Number(volume), 4);
                }
                $("#totalWeight").val(totalWeight);
                $("#totalVolume").val(totalVolume);
                if (1 == $('#express_model_isvolume').val()) {
                    // cultfeeShippingPrice(vloume);
                }

            });
            $("#shipment").click(function() {
                var agentNo = $("#agentNo").val();
                var waynum = $("#waynum").val();
                var forecastWeight = 0;
                var forecastvolumeWeight = 0;
                for (var i = 1; i <= waynum; i++) {
                    var weight = $("#forecastWeight_" + i).val();
                    if (typeof (weight) == 'NaN' || weight == "" || weight == "undefined" || weight == 0) {
                        alert("重量不能为空或者为零");
                        return;
                    }
                    var volume = $("#forecastvolumeWeight_" + i).val();
                    if (typeof (volume) == 'NaN' || volume == "" || volume == "undefined") {
                        volume = 0;
                    }
                    forecastWeight = Number(forecastWeight) + Number(weight);
                    forecastvolumeWeight = Number(forecastvolumeWeight) + Number(volume);
                }
                if (agentNo == "") {
                    alert("渠道单号不能为空!");
                } else if ($.trim(forecastWeight) == 0) {
                    alert("物品重量不能为空");
                    return false;
                } else {
        <?php if ($byweight == 1) { ?>
                        if (forecastWeight > <?php echo $payWeight ?>) {
                            var msgInfo = "该运单的打包重量大于预付重量，您确认继续设置下去？";
                            if (confirm(msgInfo, "提示信息")) {
                                $('#formshipment').submit();
                            }
                        } else {
                            $('#formshipment').submit();
                        }
        <?php } else { ?>
                        if (forecastvolumeWeight > <?php echo $payWeight ?>) {
                            var msgInfo = "该运单的打包重量大于预付重量，您确认继续设置下去？";
                            if (confirm(msgInfo, "提示信息")) {
                                $('#formshipment').submit();
                            }
                        } else {
                            $('#formshipment').submit();
                        }
        <?php } ?>
                }
            });
            $("#waynum").change(function() {
                var waynum = $(this).val();
                if (waynum <= 0) {
                    alert("包裹的数量必须大于0");
                    return "";
                }
                if (Number(waynum) > Number(way_num)) {
                    var html = "";
                    for (var i = Number(way_num) + 1; i <= waynum; i++) {
                        html += '<dl class="bag_' + i + '"><dt><span style="color:#c00;" class="startbag">' + i + "/" + waynum + '</span>重量：</dt><dd>';
                        html += '<div class="textbox"><input class="textinput" type="text" id="forecastWeight_' + i + '" name="forecastWeight_' + i + '">';
                        html += '</div><span>kg</span></dd><dt>尺寸：</dt><dd><div class="chicun">';
                        html += '<input class="textinput w30 forecastinput" i="' + i + '" type="text" id="forecastlength_' + i + '" name="forecastlength_' + i + '" ><i>X</i>';
                        html += '<input class="textinput w30 forecastinput" i="' + i + '" type="text" id="forecastwidth_' + i + '" name="forecastwidth_' + i + '" ><i>X</i>';
                        html += '<input class="textinput w30 forecastinput" i="' + i + '" type="text" id="forecastheight_' + i + '" name="forecastheight_' + i + '" >';
                        html += '<input type="hidden" id="forecastvolumeWeight_' + i + '" name="forecastvolumeWeight_' + i + '" value="0"><span>CM</span></div><span class="tijizl tjzl_' + i + '"></span></dd></dl>';
                    }
                    html += '<dl><dt>总重量：</dt><dd><div class="textbox"><input class="textinput" type="text" id="totalWeight" name="totalWeight"></div><span>kg</span></dd>';
                    html += '<dt>总体积：</dt><dd><div class="chicun"><input class="textinput" type="text" id="totalVolume" name="totalVolume"></div><span>kg</span></dd></dl>';
                    $(".bag_" + way_num).after().append(html);
                } else {
                    for (var i = Number(waynum) + 1; i <= way_num; i++) {
                        $(".bag_" + i).remove();
                    }
                }
                for (i = 0; i < waynum; i++) {
                    $('.startbag').eq(i).text((Number(i) + 1) + "/" + waynum);
                }
                if (waynum < 2) {
                    $(".startbag").text("");
                }
                way_num = waynum;
            });
            function accAdd(arg1, arg2) {
                var r1, r2, m, c;
                try {
                    r1 = arg1.toString().split(".")[1].length
                } catch (e) {
                    r1 = 0
                }
                try {
                    r2 = arg2.toString().split(".")[1].length
                } catch (e) {
                    r2 = 0
                }
                c = Math.abs(r1 - r2);
                m = Math.pow(10, Math.max(r1, r2))
                if (c > 0) {
                    var cm = Math.pow(10, c);
                    if (r1 > r2) {
                        arg1 = Number(arg1.toString().replace(".", ""));
                        arg2 = Number(arg2.toString().replace(".", "")) * cm;
                    }
                    else {
                        arg1 = Number(arg1.toString().replace(".", "")) * cm;
                        arg2 = Number(arg2.toString().replace(".", ""));
                    }
                }
                else {
                    arg1 = Number(arg1.toString().replace(".", ""));
                    arg2 = Number(arg2.toString().replace(".", ""));
                }
                return (arg1 + arg2) / m
            }
            function RoundNumber(num, pos)
            {
                return Math.round(num * Math.pow(10, pos)) / Math.pow(10, pos);
            }
    <?php } ?>
    <?php if ($this->billall->interior == Application_Model_wayBillItem::Interior_Pick) { ?>
            $("#editchannel").click(function() {
                $("#indexqudao").hide();
                $("#formshipchanner").show();
            });
            $("#editshiptype").live("change", function() {
                var id = $(this).val();
                $("#agentChannelCostPrice").html('<tr><td>正在获取报价,请稍候</td></tr>');
                $.post('/admini/managewaybill/trans', {'id': id, 'word': "<?php echo $this->billall->state; ?>", 'rweight': "<?php echo $payWeight; ?>"}, function(sj) {
                    var html = "";
                    html = '<tr><th class="jg0">选择</th><th class="jg1">渠道</th><th class="jg2">快递名称</th><th class="jg3">报价(元)</th></tr>';
                    if (sj.data) {
                        $.each(sj.data, function(key, val) {
                            html += '<tr><td><input type="radio" value="' + val.id + '" name="channel" class="channel" /></td><td>' + val.agentName + '</td><td>' + val.channelName + '</td><td>' + val.price + '</td></tr>';
                        });
                    }
                    $("#agentChannelCostPrice").html(html);
                }, 'json');
            });
            $("#radioChannel").live("click", function() {
                fillChannel($('.agentid:checked').val());
            });
            $("#affirmqudao").click(function() {
        <?php if ($ckweight) { ?>
                    if (confirm("该运单的打包重量大于预付重量，您确认继续设置下去？", "提示信息")) {
                        $.ajax({
                            type: 'POST',
                            url: '/admini/managewaybill/affirmchannel/id/<?php echo $this->billall->id; ?>',
                            success: function(data) {
                                if (data == 1) {
                                    alert("设置成功！");
                                } else {
                                    alert("请检查前后台状态");
                                }
                                location.reload();
                            }
                        });
                    }
        <?php } else { ?>
                    $.ajax({
                        type: 'POST',
                        url: '/admini/managewaybill/affirmchannel/id/<?php echo $this->billall->id; ?>',
                        success: function(data) {
                            if (data == 1) {
                                alert("设置成功！");
                            } else {
                                alert("请检查前后台状态");
                            }
                            location.reload();
                        }
                    });
        <?php } ?>
            });
            $("#shipchanner").click(function() {
        <?php if ($ckweight) { ?>
                    if (confirm("该运单的打包重量大于预付重量，您确认继续设置下去？", "提示信息")) {
                        $("#formshipchanner").submit();
                    }
        <?php } else { ?>
                    $("#formshipchanner").submit();
        <?php } ?>
            });
    <?php } ?>
    <?php if ($this->billall->interior == Application_Model_wayBillItem::Interior_AffirmChannel) { ?>
            $("#affirmjiao").click(function() {
                $.ajax({
                    type: 'POST',
                    url: '/admini/managewaybill/affirmout/id/<?php echo $this->billall->id; ?>',
                    success: function(data) {
                        if (data == 1) {
                            alert("设置成功！");
                        } else {
                            alert("请检查前后台状态");
                        }
                        location.reload();
                    }
                });
            });
    <?php } ?>
    <?php if ($this->billall->interior == Application_Model_wayBillItem::Interior_Outstorage || $this->billall->interior == Application_Model_wayBillItem::Interior_OverSystem) { ?>
            $('#length,#width,#height').change(function() {
                var length = $('#length').val();
                var width = $('#width').val();
                var height = $('#height').val();
                var vloume = length * width * height / 5000;
                if (vloume > 0) {
                    $('#lastVolumeWeight').attr('value', vloume);
                }
            });
            $('#ckmoney').live("click", function() {
                var lastWeight = parseFloat($('#lastWeight').val());
                var volumeWeight = parseFloat($('#lastVolumeWeight').val());
                volumeWeight = isNaN(volumeWeight) ? 0 : volumeWeight;
                var weight = lastWeight > volumeWeight ? lastWeight : volumeWeight;
                var wayid = $('#billid').val();
                $.ajax({
                    type: 'POST',
                    url: '/admini/managewaybill/cultfee/weight/' + weight + '/wayId/' + wayid,
                    success: function(data) {
                        if (data.refundMoney >= 0) {
                            $('#lastMoney').attr("value", data.shipMoney);
                            $('#refundMoney').attr("value", data.refundMoney);
                        } else {
                            $('#lastMoney').attr("value",<?php echo $this->billall->shipMoney; ?>);
                            $('#refundMoney').attr("value", 0);
                        }
                    }
                });
            });
            $("#shipleno").live("click", function() {
                var lastWeight = $('#lastWeight').val();
                var lastMoney = $('#lastMoney').val();
                var refundMoney = $('#refundMoney').val();
                if (lastWeight == '') {
                    alert('实际重量不能为空！');
                    return false;
                } else if (lastMoney == '') {
                    alert('实际费用不能为空！');
                    return false;
                } else if (refundMoney < 0) {
                    alert('用户预付款不足，不能发货！');
                    return false;
                } else {
                    if (refundMoney > 0) {
                        if (confirm("您确定是否要退款" + refundMoney + "元", "提示信息")) {
                            $('#formshipleno').submit();
                        }
                    } else {
                        $('#formshipleno').submit();
                    }
                }
            });
    <?php } ?>
    <?php if ($this->billall->interior == Application_Model_wayBillItem::Interior_System || $this->billall->interior == Application_Model_wayBillItem::Interior_Oversingleno) { ?>
            $("#billsingle").live("click", function() {
                var logistics = $('#logistics').val();
                if (logistics == "") {
                    alert('改单号不能为空！');
                    return false;
                } else {
                    $('#formsystem').submit();
                }
            });
    <?php } ?>
    <?php if ($this->billall->interior == Application_Model_wayBillItem::Interior_Singleno || $this->billall->interior == Application_Model_wayBillItem::Interior_OutTransportation) { ?>
            $("#affirmshang").live("click", function() {
                $.ajax({
                    type: 'POST',
                    url: '/admini/managewaybill/affirmtransportation/id/<?php echo $this->billall->id; ?>',
                    success: function(data) {
                        if (data == 2) {
                            alert("设置成功！");
                        } else {
                            alert("请检查前后台状态");
                        }
                        location.reload();
                    }
                });
            });
    <?php } ?>
    <?php if ($this->billall->interior == Application_Model_wayBillItem::Interior_Transportation || $this->billall->interior == Application_Model_wayBillItem::Interior_Overachieve) { ?>
            $("#affirmqian").live("click", function() {
                $.ajax({
                    type: 'POST',
                    url: '/admini/managewaybill/affirmachieve/id/<?php echo $this->billall->id; ?>',
                    success: function(data) {
                        if (data == 2) {
                            alert("设置成功！");
                        } else {
                            alert("请检查前后台状态");
                        }
                        location.reload();
                    }
                });
            });
    <?php } ?>
    <?php if ($this->problemWay) { ?>
        <?php if ($this->problemWay->schedule == Application_Model_ProblemWay::Schedule_Default) { ?>
                $("#PartDefault").live("click", function() {
                    $.ajax({
                        type: 'POST',
                        url: '/admini/manageproblem/partdefault/id/<?php echo $this->billall->id; ?>',
                        success: function(data) {
                            if (data == 1) {
                                alert("设置成功！");
                            } else {
                                alert("请检查前后台状态");
                            }
                            location.reload();
                        }
                    });
                });
        <?php } ?>
        <?php if ($this->problemWay->schedule == Application_Model_ProblemWay::Schedule_ApplyFor) { ?>
                $("#scheduleApplyFor").live("click", function() {
                    $.ajax({
                        type: 'POST',
                        url: '/admini/manageproblem/scheduleapplyfor/id/<?php echo $this->billall->id; ?>',
                        success: function(data) {
                            if (data == 1) {
                                alert("设置成功！");
                            } else {
                                alert("请检查前后台状态");
                            }
                            location.reload();
                        }
                    });
                });
                $("#PartApplyFor").live("click", function() {
                    $.ajax({
                        type: 'POST',
                        url: '/admini/manageproblem/partapplyfor/id/<?php echo $this->billall->id; ?>',
                        success: function(data) {
                            if (data == 1) {
                                alert("设置成功！");
                            } else {
                                alert("请检查前后台状态");
                            }
                            location.reload();
                        }
                    });
                });
        <?php } ?>
        <?php if ($this->problemWay->schedule == Application_Model_ProblemWay::Schedule_ReturnRoute) { ?>
                $("#ScheduleReturnRoute").live("click", function() {
                    $.ajax({
                        type: 'POST',
                        url: '/admini/manageproblem/schedulereturnroute/id/<?php echo $this->billall->id; ?>',
                        success: function(data) {
                            if (data == 1) {
                                alert("设置成功！");
                            } else {
                                alert("请检查前后台状态");
                            }
                            location.reload();
                        }
                    });
                });
                $("#PartReturnRoute").live("click", function() {
                    $.ajax({
                        type: 'POST',
                        url: '/admini/manageproblem/partreturnroute/id/<?php echo $this->billall->id; ?>',
                        success: function(data) {
                            if (data == 1) {
                                alert("设置成功！");
                            } else {
                                alert("请检查前后台状态");
                            }
                            location.reload();
                        }
                    });
                });
        <?php } ?>
        <?php if ($this->problemWay->schedule == Application_Model_ProblemWay::Schedule_InChannel) { ?>
                $("#ScheduleInChannel").live("click", function() {
                    $.ajax({
                        type: 'POST',
                        url: '/admini/manageproblem/scheduleinchannel/id/<?php echo $this->billall->id; ?>',
                        success: function(data) {
                            if (data == 1) {
                                alert("设置成功！");
                            } else {
                                alert("请检查前后台状态");
                            }
                            location.reload();
                        }
                    });
                });
        <?php } ?>
        <?php if ($this->problemWay->schedule == Application_Model_ProblemWay::Schedule_InUuch) { ?>
                $("#ScheduleInUuch").live("click", function() {
                    $.ajax({
                        type: 'POST',
                        url: '/admini/manageproblem/scheduleinuuch/id/<?php echo $this->billall->id; ?>',
                        success: function(data) {
                            if (data == 1) {
                                alert("设置成功！");
                            } else {
                                alert("请检查前后台状态");
                            }
                            location.reload();
                        }
                    });
                });
                $("#PartInUuch").live("click", function() {
                    $.ajax({
                        type: 'POST',
                        url: '/admini/manageproblem/partinuuch/id/<?php echo $this->billall->id; ?>',
                        success: function(data) {
                            if (data == 1) {
                                alert("设置成功！");
                            } else {
                                alert("请检查前后台状态");
                            }
                            location.reload();
                        }
                    });
                });
        <?php } ?>
    <?php } ?>
        $("#CancelReturn").live("click", function() {
            if (confirm("您确认取消对该问题运单的操作吗？", "提示信息")) {
                $.ajax({
                    type: 'POST',
                    url: '/admini/manageproblem/cancelreturn/id/<?php echo $this->billall->id; ?>',
                    success: function(data) {
                        if (data == 1) {
                            alert("设置成功！");
                        } else if (data == 2) {
                            alert("该运单已经退款了，不能取消该问题运单的操作！");
                        } else {
                            alert("请检查前后台状态");
                        }
                        location.reload();
                    }
                });
            }
        });
        function editInterior(interior, name)
        {
            if (interior < <?php echo $this->billall->interior ? $this->billall->interior : 0; ?>) {
                if (confirm("您确定把该运单的后台状态改为" + name + "？", "提示信息")) {
                    $.ajax({
                        type: 'POST',
                        url: '/admini/managewaybill/editbillinterior/id/<?php echo $this->billall->id; ?>/interior/' + interior,
                        success: function(data) {
                            if (data == 2) {
                                alert("修改成功");
                            } else {
                                alert("出现未知错误");
                            }
                            location.reload();
                        }
                    });
                }
            } else {
                alert("不能把运单状态修改于现运单的状态之下，请重新选择！");
            }
        }
        function editStatus(status, name)
        {
            if (confirm("您确定把该运单的前台状态改为" + name + "？", "提示信息")) {
                if (status == "<?php echo Application_Model_wayBillItem::STATUS_ExpressBack; ?>") {
                    $("#issue").click();
                } else if (status == "<?php echo Application_Model_wayBillItem::STATUS_Cancel; ?>") {
                    $("#cancel").click();
                } else {
                    $.ajax({
                        type: 'POST',
                        url: '/admini/managewaybill/editbillstatus/id/<?php echo $this->billall->id; ?>/status/' + status,
                        success: function(data) {
                            if (data == 2) {
                                alert("修改成功");
                            } else {
                                alert("出现未知错误");
                            }
                            location.reload();
                        }
                    });
                }
            }
        }
        $("#addlog").live("click", function() {
            var opdate = $("#opdate").val();
            var opremark = $("#opremark").val();
            if (opdate == '') {
                alert("物流时间不能为空");
            } else if (opremark == '') {
                alert("物流信息不能为空");
            } else {
                $.post('/admini/managewaybill/addlogistics', {'wayid':<?php echo $this->billall->id ? $this->billall->id : ""; ?>, 'opdate': opdate, 'opremark': opremark}, function(data) {
                    location.href = "/admini/managewaybill/billaccep/id/<?php echo $this->billall->id; ?>";
                }, 'json');
            }
        });
        $("#dellog").live("click", function() {
            var licid = $(this).attr("name");
            if (confirm("您确定删除该物流信息？", "提示信息")) {
                $.ajax({
                    type: 'POST',
                    url: '/admini/managewaybill/dellogistics/id/' + licid,
                    success: function(data) {
                        $("tr#liclog" + licid).remove();
                    }
                });
            }
        });

        $("#issue").live("click", function() {
            $("div.houtai_overlay").attr("style", "display:block;");
            $("div.isProblemContent").attr("style", "display:block;");
            $("#problem").click();
        });
        $(".nui-msgbox-close").live("click", function() {
            $("div.houtai_overlay").attr("style", "display:none;");
            $("div.tanchuang").attr("style", "display:none;");
        });
        $("#problem").live("click", function() {
            $(".wt_top").show();
            $(".wt_nav ul li").attr("class", "");
            $(this).parents("li").attr("class", "wt_on");
            $(".wenti_box2").hide();
            $("#interiorRemark").hide();
            $("#addsyProperty").hide();
            $("#shangyibag").hide();
            $("#problemComm").show();
            $("#wayProblem").show();
        });
        $("#dispose").live("click", function() {
            $(".wt_top").attr("style", "display:block");
            $(".wt_nav ul li").attr("class", "");
            $(this).parents("li").attr("class", "wt_on");
            $(".wenti_box").hide();
            $(".wenti_box2").show();
            $("#wayProblem").show();
        });
        $("#remarkUuch").live("click", function() {
            $("div.houtai_overlay").show();
            $("div.isProblemContent").show();
            $(".wt_top").hide();
            $("#wayProblem").hide();
            $("#problemComm").hide();
            $(".wenti_box2").hide();
            $("#uuchInterior").show();
            $("#shangyibag").hide();
            $("#interiorRemark").show();
            $("#addsyProperty").hide();
        });
        $("#bagProperty").click("click", function() {
            $("div.houtai_overlay").show();
            $("div.isProblemContent").show();
            $(".wt_top").hide();
            $("#wayProblem").hide();
            $("#problemComm").hide();
            $(".wenti_box2").hide();
            $("#uuchInterior").hide();
            $("#shangyibag").show();
            $("#interiorRemark").hide();
            $("#addsyProperty").show();
        });
        function addSyProperty()
        {
            var syproperty = $("#syproperty").val();
            if (syproperty == "") {
                alert("包裹属性不能为空！");
                return false;
            }
            $.ajax({
                type: 'POST',
                url: '/admini/managewaybill/addsyproperty/id/' +<?php echo $this->billall->id; ?> + '/syproperty/' + syproperty,
                success: function(data) {
                    if (data == 1) {
                        alert("设置成功！");
                        $(".showProperty").show();
                        $(".span_showProperty").text(syproperty);
                        $("#syproperty").val(syproperty);
                        $(".nui-msgbox-close").click();
                    } else {
                        alert("出现未知错误！");
                        location.reload();
                    }
                }
            });
        }
        $("#affirmjindu").click(function() {
            var schedule = $("#schedule").val();
            if (schedule == "") {
                alert("进度内容不能为空");
                return false;
            } else {
                $("#formschedule").submit();
            }
        });
        $("#ReturnCancel").live("click", function() {
            if (confirm("您确定该问题运单已和客户协商好了？确认该运单退件？", "提示信息")) {
                $.ajax({
                    type: 'POST',
                    url: '/admini/managewaybill/affirmreturncancel/id/' +<?php echo $this->billall->id; ?>,
                    success: function(data) {
                        if (data == 1) {
                            alert("设置成功！");
                        } else {
                            alert("出现未知错误！");
                        }
                        location.reload();
                    }
                });
            }
        });
        $("#PartReturn").live("click", function() {
            if (confirm("您确定该问题运单已和客户协商好了？确认该运单退回那些不符合规范的物品？", "提示信息")) {
                $.ajax({
                    type: 'POST',
                    url: '/admini/managewaybill/affirmpartreturn/id/' +<?php echo $this->billall->id; ?>,
                    success: function(data) {
                        if (data == 1) {
                            alert("设置成功！");
                        } else {
                            alert("出现未知错误！");
                        }
                        location.reload();
                    }
                });
            }
        });
        $("#achieveProblem").live("click", function() {
            if (confirm("您确定该问题运单已和客户协商好了？决定放行？", "提示信息")) {
                $.ajax({
                    type: 'POST',
                    url: '/admini/managewaybill/affirmachieveproblem/id/' +<?php echo $this->billall->id; ?>,
                    success: function(data) {
                        if (data == 1) {
                            alert("设置成功！");
                        } else {
                            alert("该运单未付款、已取消或者已完成！");
                        }
                        location.reload();
                    }
                });
            }
        });
        $("#editwaybill").live("click", function() {
            $.ajax({
                type: 'POST',
                url: '/admini/managewaybill/editwaybill/id/<?php echo $this->billall->id; ?>',
                success: function(data) {
                    if (data == 1) {
                        alert("标记成功");
                    } else {
                        alert("发生未知错误，请重新操作");
                    }
                    location.reload();
                }
            });
            return false;
        });

        $(function() {
            $.fn.numeral = function() {
                $(this).css("ime-mode", "disabled");
                this.bind("keypress", function(e) {
                    var code = (e.keyCode ? e.keyCode : e.which);  //兼容火狐 IE   
                    if (!$.browser.msie && (e.keyCode == 0x8))  //火狐下 不能使用退格键  
                    {
                        return;
                    }
                    return code >= 48 && code <= 57 || code == 46;
                });
                this.bind("blur", function() {
                    if (this.value.lastIndexOf(".") == (this.value.length - 1)) {
                        this.value = this.value.substr(0, this.value.length - 1);
                    } else if (isNaN(this.value)) {
                        this.value = " ";
                    }
                });
                this.bind("paste", function() {
                    var s = clipboardData.getData('text');
                    if (!/\D/.test(s))
                        ;
                    value = s.replace(/^0*/, '');
                    return false;
                });
                this.bind("dragenter", function() {
                    return false;
                });
                this.bind("keyup", function() {
                    this.value = this.value.replace(/[^\d.]/g, "");
                    //必须保证第一个为数字而不是.
                    this.value = this.value.replace(/^\./g, "");
                    //保证只有出现一个.而没有多个.
                    this.value = this.value.replace(/\.{2,}/g, ".");
                    //保证.只出现一次，而不能出现两次以上
                    this.value = this.value.replace(".", "$#$").replace(/\./g, "").replace("$#$", ".");
                });
            };
            $("#forecastWeight").numeral();
            $("#lastWeight").numeral();
            $("#lastVolumeWeight").numeral();
        });
        $('#formshipchanner').submit(function() {
            if ($('.channel:checked').length > 0) {
                var price = parseFloat($('.channel:checked').parent().parent().children().last().text());
                var shipMoney = parseFloat($('#shipMoney').text().replace('元', ''));
                if (price * 1.3 > shipMoney) {
                    alert('注意,本订单利润不够,请登记一下,并上报给主管!');
                }
            }
            if (($('#channer').val() == '' || $('#channer').val() == null) && $('.channel:checked').length == 0) {
                alert('请选择发货渠道');
                return false;
            }
        });
        $('#cancelEdit').click(function() {
            $('#formshipchanner').hide();
            $('#indexqudao').show();
        });
    </script>
<?php } ?>
<?= $this->formHidden('expressId', $this->billall->ExpressId) ?>
<style>
    .qudao dl{clear: both;}
</style>
<script type="text/javascript">
    $('#haveToSee').live("click", function() {
        var id = <?php echo $this->billall->id; ?>;
        $.post(
                '/admini/managewaybill/havetosee',
                {'id': id},
        function() {
            location.reload();
        }
        );
    });

    function cultfeeShippingPrice(weight) {
        var price = 0;
        $.ajax({
            url: '/admini/managewaybill/getshippingprice/wayId/<?php echo $this->billall->id; ?>/weight/' + weight,
            type: 'GET',
            async: false,
            success: function(data) {
                price = data.price;
            }
        });

        return price;
    }

    function zzfwSubmit(obj) {
        $('.houtai_overlay').css('z-index', '9999').show();
        var tanchuang = $('#zzfwfinance').closest('.tanchuang');
        tanchuang.css({'z-index': '10000', 'overflow': 'hidden'}).show();
        tanchuang.find('.retanchuang').click(function() {
            $('.houtai_overlay').hide();
            tanchuang.hide();
        });
        var typeObj = tanchuang.find('select[name="zzfwtype"]');
        typeObj.children('option').removeAttr('selected');
        typeObj.children('option[value="add"]').attr('selected', 'selected');
        zzfwOptionsRender('add', tanchuang);
        typeObj.change(function() {
            var type = $(this).val();
            zzfwOptionsRender(type, tanchuang);
        })
        tanchuang.find('.anvbotton5').bind('click', addZzfwFinance);
    }

    function addZzfwFinance() {
        $(this).unbind('click');
        $(this).children('span').text('提交');
        var tanchuang = $('#zzfwfinance').closest('.tanchuang'),
                type = tanchuang.find('select[name="zzfwtype"]'),
                vaservers = tanchuang.find('input[name="zzfyoptions"]'),
                amount = tanchuang.find('input[name="amount"]');
        var data = {},
                vaserver = '';
        for (var i = 0; i < vaservers.length; i++) {
            if (vaservers.eq(i).checked || vaservers.eq(i).attr('checked')) {
                vaserver = vaservers.eq(i).val();
                break;
            }

        }
        data['type'] = type.val();
        data['vaserver'] = vaserver;
        data['amount'] = amount.val();
        $.ajax({
            url: '/admini/managewaybill/zzfyfinance/id/<?php echo $this->billall->id; ?>',
            type: 'POST',
            data: data,
            success: function(data) {
                if (data.code == 'success') {
                    alert('手工入账成功')
                } else {
                    alert(data.message);
                }

                location.reload();
            }
        });
    }

    function zzfwOptionsRender(type, tanchuang) {
        var options = <?php echo $this->billVaServerInfo; ?>,
                optionHtml = '';
        if ('add' == type) {
            for (var i in options) {
                if (1 > options[i].value) {
                    optionHtml += '<input type="radio" name="zzfyoptions" class="vaservers" value="' + i + '" style="margin-left:15px;margin-right:3px;" /><span>' + options[i].label + '</span>';
                }
            }
        } else if ('del' == type) {
            for (var i in options) {
                if (1 <= options[i].value) {
                    optionHtml += '<input type="radio" name="zzfyoptions" class="vaservers" value="' + i + '" style="margin-left:15px;margin-right:3px;" /><span>' + options[i].label + '</span>';
                }
            }
        }
        tanchuang.find('.vaservice').html(optionHtml);
        optionHtml = '';
    }

    function deleteWaybillRemark(obj,id) {
        if (confirm("您确定删除该备注？", "提示信息")) {
            $.ajax({
                type: 'GET',
                url: '/admini/managewaybill/deleteremark/id/' + id,
                success: function(data) {
                    if (data == 1) {
                        alert("删除备注成功！");
                        obj.closest('tr').remove();
                    } else {
                        alert("发生未知错误，请重新操作");
                    }
                }
            });
        }
    }
</script>
<script type="text/javascript">
function repayHandle(obj) {
	if ($(obj).attr('checked') == 'checked') {
		$("#repay-sum").removeAttr('readonly');
	} else {
		$("#repay-sum").attr('readonly', 'true');
	}	
}
</script>
